Class ExtendedRoleManager<TRole>
Provides the APIs for managing roles in a persistence store.
Inherited Members
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class ExtendedRoleManager<TRole> : RoleManager<TRole>, IDisposable where TRole : class, IRole, new()
Type Parameters
TRole
The type encapsulating a role. |
Constructors
ExtendedRoleManager(IRoleStore<TRole>, IEnumerable<IRoleValidator<TRole>>, IServiceProvider, ILookupNormalizer, IdentityErrorDescriber, ILogger<ExtendedRoleManager<TRole>>)
Constructs a new instance of ExtendedRoleManager<TRole>.
Declaration
public ExtendedRoleManager(IRoleStore<TRole> store, IEnumerable<IRoleValidator<TRole>> roleValidators, IServiceProvider services, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger<ExtendedRoleManager<TRole>> logger)
Parameters
IRoleStore<TRole>
store
The persistence store the manager will operate over. |
IEnumerable<Microsoft.AspNetCore.Identity.IRoleValidator<TRole>>
roleValidators
A collection of validators for roles. |
System.IServiceProvider
services
The System.IServiceProvider used to resolve services. |
Microsoft.AspNetCore.Identity.ILookupNormalizer
keyNormalizer
The normalizer to use when normalizing role names to keys. |
Microsoft.AspNetCore.Identity.IdentityErrorDescriber
errors
The Microsoft.AspNetCore.Identity.IdentityErrorDescriber used to provider error messages. |
Microsoft.Extensions.Logging.ILogger<ExtendedRoleManager<TRole>>
logger
The logger used to log messages, warnings and errors. |
Methods
AddPermissionAsync(TRole, String)
Adds the specified permission
to the role.
Declaration
public virtual async Task<IdentityResult> AddPermissionAsync(TRole role, string permission)
Parameters
TRole
role
The role to add the permission to. |
String
permission
The Permission to add. |
Returns
System.Threading.Tasks.Task<IdentityResult>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult for the add. |
CreateFromTemplateAsync(IRoleTemplate, Nullable<Guid>)
Creates a new role from the specified template
in the persistence store.
Declaration
public virtual async Task<IdentityResult> CreateFromTemplateAsync(IRoleTemplate template, Guid? tenantId = null)
Parameters
IRoleTemplate
template
The IRoleTemplate to create a new role for. |
System.Nullable<System.Guid>
tenantId
The identity of the tenant that the role should be created for. |
Returns
System.Threading.Tasks.Task<IdentityResult>
The System.Threading.Tasks.Task that represents the asynchronous operation. |
CreateRoleFromTemplateAsync(IRoleTemplate)
Creates a new instance of TRole
based on the specified template
.
Declaration
protected virtual async Task<IdentityResult> CreateRoleFromTemplateAsync(IRoleTemplate template)
Parameters
IRoleTemplate
template
The IRoleTemplate to create a new role for. |
Returns
System.Threading.Tasks.Task<IdentityResult>
A new instance of |
DeleteAsync(TRole)
Declaration
public override Task<IdentityResult> DeleteAsync(TRole role)
Parameters
TRole
role
|
Returns
System.Threading.Tasks.Task<IdentityResult>
|
Overrides
GetAllRolesAsync(RolesSearchQuery)
Gets all roles.
Declaration
public virtual Task<QueryResult<TRole>> GetAllRolesAsync(RolesSearchQuery query)
Parameters
RolesSearchQuery
query
The query describing filtering and sorting for the roles. |
Returns
System.Threading.Tasks.Task<QueryResult<TRole>>
A System.Threading.Tasks.Task that represents the QueryResult<T> of the asynchronous query. |
GetUserRolesAsync(Guid)
Retrieves the roles the specified userId
is a member of.
Declaration
public Task<List<TRole>> GetUserRolesAsync(Guid userId)
Parameters
System.Guid
userId
The id of the user whose roles should be retrieved. |
Returns
System.Threading.Tasks.Task<List<TRole>>
A System.Threading.Tasks.Task<TResult> that contains the roles the user is a member of. |
RemovePermissionAsync(TRole, String)
Removes the specified permission
from the role.
Declaration
public virtual async Task<IdentityResult> RemovePermissionAsync(TRole role, string permission)
Parameters
TRole
role
The role to remove the permission from. |
String
permission
The identity of the functionality to remove permission for. |
Returns
System.Threading.Tasks.Task<IdentityResult>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult for the remove. |
UpdateRoleFromTemplateAsync(TRole, IRoleTemplate)
Updates the existing instance of existingRole
based on the specified template
.
Declaration
protected virtual async Task<IdentityResult> UpdateRoleFromTemplateAsync(TRole existingRole, IRoleTemplate template)
Parameters
TRole
existingRole
The existing role to update from template. |
IRoleTemplate
template
The IRoleTemplate to create a new role for. |
Returns
System.Threading.Tasks.Task<IdentityResult>
The System.Threading.Tasks.Task that represents the asynchronous operation. |