Application permissions are actions related to global backend actions (for example, managing users, roles, files and licenses). The application permissions are listed under the Telerik.Sitefinity.Security.AppAction enumeration and are associated with the Backend permission set. To manage application permissions, you use SecurityManager.
Application permissions configuration
The application permissions in SecurityConfig are presented with the SecurityConstants.Sets.Backend permission set.
The following code queries for the application permissions set and the manage users action. For more information, see For developers: Permissions configuration.
To get the application permissions set configuration, you can also use the AppPermissions class. For more information, see AppPermissions.
The AppPermissions class is helper class for working with application permissions.
AppPermissions provides you with the following properties and methods:
- IsGranted - you use the IsGranted method to check whether permissions are granted for the current user. To specify the actions, you use array of AppAction or bitwise OR mask.
- Demand - you use the Demand method to demand permissions for the current user. To specify the actions, you use array of AppAction or bitwise OR mask.
- Root - returns the application permissions security root.
- Settings - returns the backend permission set configuration from SecurityConfig. For more information, see For developers: Permissions configuration.
Granting user with manage files permission
The following example grants the specified user with the manage files permissions.
First, you initialize the users and security managers. Then, you get the application permissions security root. The ID of the security root is persisted in AppPermissions.Root.Id. You create the permissions using the CreatePermissions method of the security manager. For more information, see For developers: CRUD operations with permissions. To grant the manage files action, you use the GrantActions method. For more information, see For developers: Grant and deny permissions. Then, you add the permissions to the security root. Finally, you save the changes.