Skip to content

PermissionGrantOptions class

namespace: Serenity.Extensions   assembly: Serenity.Extensions

Who can grant or revoke which permissions, read from the "PermissionGrants" section of the settings, as a list of permission key patterns (see PermissionPattern) for each PermissionGrantTier, separated by commas, semicolons or white space (see SettingsList), e.g.

"PermissionGrants": {
  "Grantable": "*",
  "HolderOnly": "Administration:*",
  "SuperAdminOnly": "Administration:Security, Administration:Credentials"
}

A key gets the most restrictive tier with a pattern that matches it, so a broad "Grantable" never loosens a stricter one, and a key that matches no pattern is HolderOnly. Without the section, everything is grantable, as before. The lists are texts rather than arrays, as a settings file or an environment variable replaces a text as a whole, where the items of an array would be merged by their index.

public class PermissionGrantOptions

Public Members

name description
PermissionGrantOptions() The default constructor.
Grantable { get; set; } The patterns of the permissions that any administrator who can manage permissions can grant, also one who does not have them. When not set, DefaultGrantable; an empty text means none.
HolderOnly { get; set; } The patterns of the permissions that only an administrator who has them can grant.
SuperAdminOnly { get; set; } The patterns of the permissions that only a super admin can grant.
GetTier(…) Gets who can grant a permission: the most restrictive tier with a pattern that matches it, else HolderOnly.
const DefaultGrantable The grantable patterns when Grantable is not set: everything.
const SectionKey The default section key in appsettings.json

See Also