IUserRoleStore<TUser> Interface¶
Provides an abstraction for a store which maps users to roles.
- Namespace
Microsoft.AspNetCore.Identity
- Assemblies
- Microsoft.AspNetCore.Identity
Syntax¶
public interface IUserRoleStore<TUser> : IUserStore<TUser>, IDisposable where TUser : class
-
interface
Microsoft.AspNetCore.Identity.
IUserRoleStore<TUser>
¶
Methods¶
-
AddToRoleAsync
(TUser, System.String, System.Threading.CancellationToken)¶ Add a the specified <em>user</em> to the named role.
Arguments: - user (TUser) – The user to add to the named role.
- roleName (System.String) – The name of the role to add the user to.
- cancellationToken (System.Threading.CancellationToken) – The
System.Threading.CancellationToken
used to propagate notifications that the operation should be canceled.
Return type: System.Threading.Tasks.Task
Returns: The
System.Threading.Tasks.Task
that represents the asynchronous operation.Task AddToRoleAsync(TUser user, string roleName, CancellationToken cancellationToken)
-
GetRolesAsync
(TUser, System.Threading.CancellationToken)¶ Gets a list of role names the specified <em>user</em> belongs to.
Arguments: - user (TUser) – The user whose role names to retrieve.
- cancellationToken (System.Threading.CancellationToken) – The
System.Threading.CancellationToken
used to propagate notifications that the operation should be canceled.
Return type: System.Threading.Tasks.Task<System.Collections.Generic.IList<System.String>>
Returns: The
System.Threading.Tasks.Task
that represents the asynchronous operation, containing a list of role names.Task<IList<string>> GetRolesAsync(TUser user, CancellationToken cancellationToken)
-
GetUsersInRoleAsync
(System.String, System.Threading.CancellationToken)¶ Returns a list of Users who are members of the named role.
Arguments: - roleName (System.String) – The name of the role whose membership should be returned.
- cancellationToken (System.Threading.CancellationToken) – The
System.Threading.CancellationToken
used to propagate notifications that the operation should be canceled.
Return type: System.Threading.Tasks.Task<System.Collections.Generic.IList<TUser>>
Returns: The
System.Threading.Tasks.Task
that represents the asynchronous operation, containing a list of users who are in the named role.Task<IList<TUser>> GetUsersInRoleAsync(string roleName, CancellationToken cancellationToken)
-
IsInRoleAsync
(TUser, System.String, System.Threading.CancellationToken)¶ Returns a flag indicating whether the specified <em>user</em> is a member of the give named role.
Arguments: - user (TUser) – The user whose role membership should be checked.
- roleName (System.String) – The name of the role to be checked.
- cancellationToken (System.Threading.CancellationToken) – The
System.Threading.CancellationToken
used to propagate notifications that the operation should be canceled.
Return type: System.Threading.Tasks.Task<System.Boolean>
Returns: The
System.Threading.Tasks.Task
that represents the asynchronous operation, containing a flag indicating whether the specified <em>user</em> is a member of the named role.Task<bool> IsInRoleAsync(TUser user, string roleName, CancellationToken cancellationToken)
-
RemoveFromRoleAsync
(TUser, System.String, System.Threading.CancellationToken)¶ Add a the specified <em>user</em> from the named role.
Arguments: - user (TUser) – The user to remove the named role from.
- roleName (System.String) – The name of the role to remove.
- cancellationToken (System.Threading.CancellationToken) – The
System.Threading.CancellationToken
used to propagate notifications that the operation should be canceled.
Return type: System.Threading.Tasks.Task
Returns: The
System.Threading.Tasks.Task
that represents the asynchronous operation.Task RemoveFromRoleAsync(TUser user, string roleName, CancellationToken cancellationToken)
-