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:
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.
- In JReport Designer, click File > Catalog Management > Open Catalog on the menu bar.
- 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.
- In the Data tab, go to the Data Source 1 > Security > Business View Security node, right-click and select Edit Business View Security.
- In the Edit Business View Security dialog, click and select Import from JReport Server.
- 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.
- Select User1 in the principal box, then go to the Resources box and select Region in the WorldWideSalesBV.
- In the Data Security box, allow the Access permission.
- Click above the Allowed Set box.
- 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.
- In the Edit Business View Security dialog, uncheck the option Allow Unspecified Members and allow the Visible permission.
- Select User2 and the same field Region, allow the Access permission, then click above the Denied Set box.
- In the Edit Values dialog, select North America from the Available Values box and click , then click OK.
- In the Edit Business View Security dialog, allow the Visible permission for User2.
- 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.
- In JReport Designer, click File > New > Web Report on the menu bar. A blank web report is created.
- From the Toolbox panel on the left, drag Crosstab into the web report. The Create Crosstab wizard is displayed.
- In the Data screen, select WorldWideSalesBV under Data Source 1, then click Next.
- 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.
- Click the View tab to preview the crosstab. It shows full data.
- 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.
- Click File > Publish and Download > Publish to Server > Publish Report to Server on JReport Designer menu bar.
- In the Connect to JReport Server dialog, specify the required connection information, then click Connect.
- In the Publish to JReport Server dialog, unselect the All checkbox and then select the catalog and mlscrstab.wls only.
- 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.
- 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.
- 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.
- 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.
- Log onto the JReport Console page as User1 with the password abc.
- On the Resources page, open the Public Reports folder and run the web report mlscrstab.wls. The result will be:
- Log out and then log in again as User2 with the password xyz. Run the report and the result will be: