Using Security Context

Using in the Formula Editor

The Formula Editor now allows you to pass the Security Context to a user-defined formula (UDF) function.

You can call getSecurityContext () in your formula, which will pass the returning object to your UDF function. The method getSecurityContext() returns a DbSecurityContext type object, which provides the method get () to get the Security Context instance transfer from Server or Designer.

DbSecurityContext is a new data type for the SecurityContext object, since the data type of all the variables used in UDF functions should be DbValue.

The following is an example.

Import userClass from "UserFunction";
userClass.getData(getSecurityContext(), @country, …);

Using in the Deployment Wizard

JReport provides you with two API methods which allow you to bring out your own publishing tool.

DeploymentWizard

DeploymentWizardFactory

Working principle

Using in viewing report

When you click on the View tab to view a report that requires the security context to run, JReport Designer will use the implemented JRSecurityContextFactory to instantiate the SecurityContext instance which will be used to execute the report.