### Example of using member-level security

This example is based on the business view WorldWideSalesBV in the SampleReports.cat catalog file. It is assumed that the server administrator has already created two users on JReport Server: User1 and User2, with the passwords abc and xyz respectively. We will create a member-level security policy on SampleReports.cat to limit the two users' access to different group members of WorldWideSalesBV.

The example is divided into the following tasks:

- Task 1: Set member-level security on business view groups
- Task 2: Create a crosstab and publish it to JReport Server
- Task 3: View the crosstab

Before starting the example, make sure JReport Server is started.

#### Task 1: Set member-level security on business view groups

In this task, we will import the two server users to JReport Designer and limit their access to different members of the Region group in WorldWideSalesBV.

1. In JReport Designer, click File > Catalog Management > Open Catalog on the menu bar.
2. In the Open Catalog File dialog, browse to select the SampleReports.cat catalog file in `<install_root>\Demo\Reports\SampleReports`, then click the Open button. The Catalog Browser shows up.
3. In the Data tab, go to the Data Source 1 > Security > Business View Security node, right-click and select Edit Business View Security.
4. In the Edit Business View Security dialog, click and select Import from JReport Server.
5. In the Connect to JReport Server dialog, specify the required connection information, then click Connect.

   The principals created on the server will all be imported and listed in the principal box.

Next, we will assign field members availability to User1 and User2. We will make User1 have access on the North America region only and User2 regions other than North America.

1. Select User1 in the principal box, then go to the Resources box and select Region in the WorldWideSalesBV.
2. In the Data Security box, allow the Access permission.
3. Click above the Allowed Set box.
4. In the Edit Values dialog, select North America from the Available Values box and click to add it to the Selected Values box, then click OK to close the dialog.

5. In the Edit Business View Security dialog, uncheck the option Allow Unspecified Members and allow the Visible permission.

6. Select User2 and the same field Region, allow the Access permission, then click above the Denied Set box.
7. In the Edit Values dialog, select North America from the Available Values box and click , then click OK.
8. In the Edit Business View Security dialog, allow the Visible permission for User2.

9. Click OK in the Edit Business View Security dialog to save the changes.

#### Task 2: Create a crosstab and publish it to JReport Server

In this task, we will create a crosstab using WorldWideSalesBV and then publish it to JReport Server.

1. In JReport Designer, click File > New > Web Report on the menu bar. A blank web report is created.
2. From the Toolbox panel on the left, drag Crosstab into the web report. The Create Crosstab wizard is displayed.
3. In the Data screen, select WorldWideSalesBV under Data Source 1, then click Next.
4. In the Display screen, select Region as the column field, Category as the Row field, and Total Sales as the summary field, then click Finish to create the crosstab.

5. Click the View tab to preview the crosstab. It shows full data.

6. Go back to the Design tab and click the Save button to save the crosstab as mlscrstab.wls.

Next, we will publish the crosstab to JReport Server.

1. Click File > Publish and Download > Publish to Server > Publish Report to Server on JReport Designer menu bar.
2. In the Connect to JReport Server dialog, specify the required connection information, then click Connect.
3. In the Publish to JReport Server dialog, unselect the All checkbox and then select the catalog and mlscrstab.wls only.
4. Click the Browse button next to the Publish Resource To text field, then in the Select Folder dialog, select Public Reports in the Folder box and click OK.
5. In the Publish to JReport Server dialog, click the More Options button, select mlscrstab.wls in the resource box, then on the right panel, switch to the Permissions tab.

We will grant the two users the necessary permissions on the web report, so that after the report is published to JReport Server, they are able to run them.

1. Select the Enable Setting Permissions checkbox, click the User sub tab, select User1 in the user box and check the Visible and Execute checkboxes; select User2 and do the same.
2. Click the OK button to publish the resources to JReport Server.

#### Task 3: View the crosstab

Now, we can log onto JReport Server as User1 and User2 separately to view the crosstab.

1. Log onto the JReport Console page as User1 with the password abc.
2. On the Resources page, open the Public Reports folder and run the web report mlscrstab.wls. The result will be:

3. Log out and then log in again as User2 with the password xyz. Run the report and the result will be: