UserStore<TUser,TRole,TContext,TKey,TUserClaim,TUserRole,TUserLogin,TUserToken,TRoleClaim>.IsInRoleAsync 方法

定义

返回一个标志,指示指定的用户是否是给定 normalizedRoleName的成员。

public virtual System.Threading.Tasks.Task<bool> IsInRoleAsync (TUser user, string normalizedRoleName, System.Threading.CancellationToken cancellationToken = default);
public override System.Threading.Tasks.Task<bool> IsInRoleAsync (TUser user, string normalizedRoleName, System.Threading.CancellationToken cancellationToken = default);
abstract member IsInRoleAsync : 'User * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.IsInRoleAsync : 'User * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.IsInRoleAsync : 'User * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Overridable Function IsInRoleAsync (user As TUser, normalizedRoleName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)
Public Overrides Function IsInRoleAsync (user As TUser, normalizedRoleName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)

参数

user
TUser

应检查其角色成员身份的用户。

normalizedRoleName
String

要检查成员身份的角色

cancellationToken
CancellationToken

CancellationToken,用于传播应取消操作的通知。

返回

Task<TResult> 个 ,它包含一个标志,指示指定的用户是否是给定组的成员。 如果用户是组的成员,则返回的值为 true,否则为 false。

实现

适用于