To manage roles, use the Telerik.Sitefinity.Security.RoleManager class. To get an instance of the manager with the default roles data provider use the following line of code:
RoleManager roleManager = RoleManager.GetManager();
However this will not work with the out of the box roles (Administrators, Editors, Authors etc.) as they are coming from the AppRoles provider. So you must get an instance of the provider by passing the SecurityManager.ApplicationRolesProviderName as a parameter:
RoleManager roleManager = RoleManager.GetManager(SecurityManager.ApplicationRolesProviderName);
For more information, see For developers: Roles data providers.
The following example creates a role.
You can query a role by:
Querying a role by ID
The following example queries for a role by its ID.
Querying a role by name
The following example queries for a role by its name.
Querying all roles
The following example queries for all roles
The following example modifies a role by changing its name.
The following example deletes a role.
Back To Top