Access to all JasperReports Server functionality is based on assigned user-level and role-level permissions. Thus, managing users and roles is a critical aspect of the public API.
The com.jaspersoft.jasperserver.api.metadata.user.service.UserAuthorityService interface has methods for creating, modifying, and removing users and roles. The API manipulates only these two types of entities for which public interfaces are available:
• | Users are represented by the com.jaspersoft.jasperserver.api.metadata.user.domain.User interface. |
• | Roles are represented by the com.jaspersoft.jasperserver.api.metadata.user.domain.Role interface. |
A new user can be defined in a few easy steps:
The setTenantId method specifies the organization the user belongs to. However, note the following:
• | If you are using commercial editions of JasperReports Server, you should use the method in most cases, but if your instance hosts only a single instance, this method should set most user’s organization to the default (organization_1). |
• | If this is a special administrative user (similar to superuser) that shouldn’t be affiliated with an organization, do not call setTenantId. |
To get the user information from the database, the getUser method can be called by providing the user name.
Users can be removed from the database by name with the deleteUser method.
Equivalent methods for managing roles are available in the UserAuthorityService. You can assign users to roles using the following two methods:
Additional methods for finding users with specific roles are available; you can find details about them if you consult the Javadoc for the UserAuthorityService interface.
Recommended Comments
There are no comments to display.