IUserRoleStore<TUser> Interface

Summary

Provides an abstraction for a store which maps users to roles.

Syntax

public interface IUserRoleStore<TUser> : IUserStore<TUser>, IDisposable where TUser : class

GitHub

View on GitHub

interface Microsoft.AspNet.Identity.IUserRoleStore<TUser>

Methods

AddToRoleAsync(TUser, System.String, System.Threading.CancellationToken)

Add a the specified user to the named role, as an asynchronous operation.

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 <see cref=”T: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 user belongs to, as an asynchronous operation.

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 <see cref=”T: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 <see cref=”T: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 user is a member of the give named role, as an asynchronous operation.

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 <see cref=”T:System.Threading.Tasks.Task” /> that represents the asynchronous operation, containing a flag indicating whether the specified <see cref=”!:user” /> 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 user from the named role, as an asynchronous operation.

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 <see cref=”T:System.Threading.Tasks.Task” /> that represents the asynchronous operation.

Task RemoveFromRoleAsync(TUser user, string roleName, CancellationToken cancellationToken)