#### Applying a connection-scope security policy to a report

To apply a connection-scope security policy to a report, follow the steps below:

1. In JReport Designer, open the report to which you want to apply the security policy.
2. In the Report Inspector, select the node that represents the dataset the report uses in the Datasets node.
3. In the Security section of the Properties panel, select a required security policy for the Security Policy Name property.
4. Click File > Options on the menu bar, in the General category of the Options dialog, specify the security identifier by the User Name option.
5. Preview the report to see the result. You will not be able to view any records if the user name you specify doesn't exist in the defined security policy.

After you have applied a connection-scope security policy for a report in JReport Designer, you can then publish it to JReport Server as normal. Then when you log onto JReport Server as different users, you will find that the security settings have been applied to the report. That is, different users will only see the data they are supposed to see. However, as the user defined users and roles in a connection-scope security policy may not be recognized by JReport Server, if your security policy contains such users/roles, you need to first create these users and roles respectively on JReport Server, and then in JReport Designer, synchronize the security information with the server by means of importing security information from the sever with the Merge option checked.

Notes:

- Column-level security (CLS) is not supported on library component at present, so for a library component, only the data source security policies which have not been defined with CLS will be available in the value list of the Security Policy Name property.
- Security policies for the primary report and subreport can be set and applied individually, with different combinations causing different results. The relationships between the security policy settings and the try-viewing results are shown in the following table:

  main | sub | Users in Policy | Users NOT in Policy
  --- | --- | --- | ---
  Ð | Ð | No security policy is applied to either the primary report or the subreport. Users can therefore view all records in both reports.
  Ï | Ð | Can view specified records in the primary report and all records in the subreport. | Can view no records in the primary report and all records in the subreport.
  Ð | Ï | Can view all records in the primary report and specified records in the subreport. | Can view all records in the primary report and no records in the subreport.
  Ï | Ï | Can view specified records in both the primary report and the subreport. | Can view no records in either the primary report or the subreport.

  Ï - Security policy has been set and applied.
  Ð - Security policy has not been set and applied.