Class ClaimsAuthorisation
public class ClaimsAuthorisation : IAuthorisation
- Inheritance
-
ClaimsAuthorisation
- Implements
- Derived
- Inherited Members
Fields
ADMIN_ROLE
public const string ADMIN_ROLE = "admin"
Field Value
ROLE_KEY
public const string ROLE_KEY = "role"
Field Value
Methods
AddRoleAsync(IUserAccount, string, CancellationToken?)
public static Task AddRoleAsync(IUserAccount account, string name, CancellationToken? cancellationToken = null)
Parameters
accountIUserAccountnamestringcancellationTokenCancellationToken?
Returns
GetDefaultPermissions(CallbackEnvironment)
The rights assigned to all users regardless of their roles.
[Obsolete("Use GetDefaultPermissions(CallbackEnvironment, EntityMetadataDictionary, Role)")]
public virtual PermissionSet GetDefaultPermissions(CallbackEnvironment environment)
Parameters
environmentCallbackEnvironment
Returns
GetDefaultPermissions(CallbackEnvironment, EntityMetadataDictionary)
The rights assigned to all users regardless of their roles. Called by the framework in preference to GetDefaultPermissions(CallbackEnvironment), which it falls back to.
public virtual PermissionSet GetDefaultPermissions(CallbackEnvironment environment, EntityMetadataDictionary metadata)
Parameters
environmentCallbackEnvironmentmetadataEntityMetadataDictionary
Returns
GetIdentityRolesAsync(CallbackEnvironment, IEntityContext, Identity)
The roles assigned to a user.
public Task<IReadOnlySet<Role>> GetIdentityRolesAsync(CallbackEnvironment environment, IEntityContext scopedContext, Identity subject)
Parameters
environmentCallbackEnvironmentscopedContextIEntityContextsubjectIdentity
Returns
GetRoleCatalogue(CallbackEnvironment, EntityMetadataDictionary)
The roles supported by this policy in declaration order, or null if there isn't a fixed set. Called by the framework in preference to GetRoleCatalogue(CallbackEnvironment), which it falls back to.
public virtual IReadOnlyList<ClaimsRole> GetRoleCatalogue(CallbackEnvironment environment, EntityMetadataDictionary metadata)
Parameters
environmentCallbackEnvironmentmetadataEntityMetadataDictionary
Returns
GetRolePermissions(CallbackEnvironment, EntityMetadataDictionary, Role)
The rights assigned to a role (which may be in turn be assigned to users or groups). Called by the framework in preference to GetRolePermissions(CallbackEnvironment, Role), which it falls back to.
public virtual PermissionSet GetRolePermissions(CallbackEnvironment environment, EntityMetadataDictionary metadata, Role role)
Parameters
environmentCallbackEnvironmentmetadataEntityMetadataDictionaryroleRole
Returns
GetRolePermissions(CallbackEnvironment, Role)
The rights assigned to a role (which may be in turn be assigned to users or groups).
[Obsolete("Use GetRolePermissions(CallbackEnvironment, EntityMetadataDictionary, Role)")]
public virtual PermissionSet GetRolePermissions(CallbackEnvironment environment, Role role)
Parameters
environmentCallbackEnvironmentroleRole
Returns
IsAdmin(IUserAccount)
public static bool IsAdmin(IUserAccount account)
Parameters
accountIUserAccount
Returns
IsAdminAsync(IUserAccount, CancellationToken?)
public static Task<bool> IsAdminAsync(IUserAccount account, CancellationToken? cancellationToken = null)
Parameters
accountIUserAccountcancellationTokenCancellationToken?
Returns
RemoveRoleAsync(IUserAccount, string, CancellationToken?)
public static Task RemoveRoleAsync(IUserAccount account, string name, CancellationToken? cancellationToken = null)
Parameters
accountIUserAccountnamestringcancellationTokenCancellationToken?
Returns
SetAdminAsync(IUserAccount, bool, CancellationToken?)
public static Task SetAdminAsync(IUserAccount account, bool isAdmin, CancellationToken? cancellationToken = null)
Parameters
accountIUserAccountisAdminboolcancellationTokenCancellationToken?