## Cached report bursting

Cached report bursting is a security mechanism for controlling access to data at the group level in a report. By defining which groups of data are available to which users, groups, or roles, report results are created for each user, role and group. When a user accesses the report result, JReport checks the user, group and role of the user and merges the groups of data in the report the user is authorized to see and displays it to the user. Cached report bursting is implemented with these security properties on the group panel: Cascade, Grant, Groups, and Roles. The feature enables different users to view different data groups according to their access privileges. It also applies to nested groups.

### Setting up a cached report bursting policy for a report

The Cascade, Grant, Groups, and Roles properties are provided for building a report with cached report bursting. For details about the properties, see Security.

Below is an example which illustrates how to set cached report bursting:

1. In JReport Designer, create a banded report for customer information which is grouped by the Country field.
2. Create a formula to control the Grant property value. This formula returns a String value indicating which user will have the privilege to access which group of data.

   Here, we write the formula Burst_User to set the security identifier as follows:

   `if (@Country == "China" || @Country == "Canada")
   return "admin";
   if (@Country == "USA")
   return "jennifer";`

   "admin" and "jennifer" are two users assigned by the JReport Server administrator. The above formula states that, the user "admin" is authorized to view only the China and Canada groups, while the user "jennifer" can only view the USA group. If the formula is written as follows:

   `if ( @Country =="USA")
   return "user1|user2|user3";`

   Then, user1, user2, and user3 can view the USA group.

   Note: The returned value specified in the formula must be the same as the user ID defined in JReport Server. Also, the user ID is case sensitive.

3. Create a formula Burst_Group to control the Groups property value. This formula returns a String value indicating which group of users will have the privilege to access which group of data.

   `if(@Country=='Italy')
   return 'group1';
   if(@Country=='USA')
   return 'group2';`

4. Create a formula Burst_Role to control the Roles property value. This formula returns a String value indicating which role will have the privilege to access which group of data.

   `if(@Country=='Japan')
   return 'role1';
   if(@Country=='USA')
   return 'role2';`

5. In the Report Inspector, select the node that represents the group. Then, in the Security section of the Properties panel, set Cascade to true, the Grant property's value to the formula Burst_User, Groups to Burst_Group, and Roles to Burst_Role.

Since the control of report access is not possible without user ID, the significance of this function is only apparent when other users try to access a report after it has been published to JReport Server. When an end user views a report with cached report bursting on JReport Server, the corresponding group will be displayed according to the security identifier.

In the above example, if "admin" belongs to group1 and role1, he will be able to view the China, Canada, Italy, and Japan groups. jennifer will be able to view only the USA group if she belongs to group2 and role2.

See also the following topics in the JReport Server User's Guide for details about how to work with cached report bursting on the server side:

- Viewing a report with cached report bursting
- Scheduling a report with cached report bursting
- Example: E-mailing billing reports