RoleService.GetRolesForCurrentUser 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回已登录用户的所有角色。
public:
cli::array <System::String ^> ^ GetRolesForCurrentUser();
[System.ServiceModel.OperationContract]
public string[] GetRolesForCurrentUser ();
[<System.ServiceModel.OperationContract>]
member this.GetRolesForCurrentUser : unit -> string[]
Public Function GetRolesForCurrentUser () As String()
返回
String[]
用户所属角色的名称数组。
- 属性
例外
未启用角色管理。
注解
方法 GetRolesForCurrentUser 返回用户的所有角色。 当必须检查或保留所有用户的角色以确定哪些资源可供用户使用时,请使用 GetRolesForCurrentUser 方法。 可以使用此方法避免多次调用 IsCurrentUserInRole 方法。
GetRolesForCurrentUser调用 方法会SelectingProvider引发 事件。
注意
不要从在 Web 服务器上执行的代码中调用 GetRolesForCurrentUser 方法。 仅作为 WCF 服务的一部分调用 GetRolesForCurrentUser 方法。 有关如何在 Web 服务器上执行的代码中读取用户角色的详细信息,请参阅 GetRolesForUser 方法。
适用于
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈