Create permission sets

To create a permission set you must perform the following:

  1. Get the configuration manager.
    Get an instance of the ConfigManager object.
  2. Get the security configuration section.
    To get the section, call the GetSection method of the configuration manager and pass the SecurityConfig type as generic argument.
  3. Get the permissions element of the section.
    The permissions element of the section is stored in the Permissions property.
  4. Check if the permission set exists.
    Make sure that a permission set with the same name does not exist.
  5. Create new permission set.
    To create a new permission set create a new instance of the Telerik.Sitefinity.Security.Configuration.Permission class. In the constructor pass the permissions element of the security section. Set the following properties:
    • Name
      Gets or sets the programmatic name of the permission set. When granting or denying permissions, you use this name to access the permission set. The string must not contain any unsafe characters or spaces.
    • Title
      Gets or sets the display name of the permission set. The value of this property is displayed in the UI.
    • Description
      Gets or sets additional information about the permission set.
    • ResourceClassId
      Gets or sets the name of the resource class. If the value is null or empty, the values of the Title and the Description properties are displayed. If there is a resource class assigned, the values of the Title and the Description properties must represent keys to entries in this resource class.
  6. Add the permission set to the section.
    To add the permission set to the security configuration section, add the instance to the permissions element.
  7. Create actions.
    To create an action in the permission set, you must create an instance of the SecurityAction class. In the constructor pass the permissions element of the security section. Set the following properties:
    • Name
      Gets or sets the programmatic name of the action. When granting or denying permissions, you use this name to access the action. The string must not contain any unsafe characters or spaces.
    • Type
      Gets or sets the type of the action. The SecurityActionTypes enumeration has the following values:
      • None
      • View
        Grants/denies querying an item.
      • Create
        Grants/denies creating an item.
      • Modify
        Grants/denies modifying an item.
      • Manage
        Grants denies modifying an item and managing its child items, e.g. "manage" a blog grants/denies modifying blog, and creating, deleting, and modifying its posts.
      • Delete
        Grants/denies deleting an item.
      • ChangeOwner
        Grants/denies changing the ownership of an item.
      • ChangePermissions
        Grants/denies changing the permissions of an item.
    • Title
      Gets or sets the display name of the action. The value of this property is displayed in the UI.
    • Description
      Gets or sets additional information about the action.
    • ResourceClassId
      Gets or sets the name of the resource class. If the value is null or empty, the values of the Title and the Description properties are displayed. If there is a resource class assigned, the values of the Title and the Description properties must represent keys to entries in this resource class.
  8. Add the action to the permission set.
    To add the action to the permission set, add the instance of the action to the Actions collection of the permissions configuration element.
  9. Save the section.
    To save the permission set, you have to save the security configuration section by calling the SaveSection method of the manager and passing the instance of the section as an argument.
Here is a code example:


Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?