RoleService.IsCurrentUserInRole(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷已登入的使用者是否屬於指定角色。
public:
bool IsCurrentUserInRole(System::String ^ role);
[System.ServiceModel.OperationContract]
public bool IsCurrentUserInRole(string role);
[<System.ServiceModel.OperationContract>]
member this.IsCurrentUserInRole : string -> bool
Public Function IsCurrentUserInRole (role As String) As Boolean
參數
- role
- String
要查職缺名稱。
傳回
true如果使用者處於指定角色;否則,。 false
- 屬性
例外狀況
role 是 null 或使用者未登入。
角色管理未啟用。
備註
此 IsCurrentUserInRole 方法檢查已登入使用者是否屬於指定角色。 這個 IsCurrentUserInRole 方法提升了事件的水準 SelectingProvider 。
Note
不要從網頁伺服器上執行的程式碼呼叫該 IsCurrentUserInRole 方法。 你只會在 WCF 服務中呼叫這個 IsCurrentUserInRole 方法。 欲了解更多如何從網頁伺服器執行的程式碼中檢查使用者是否屬於指定群組的資訊,請參閱此 IsUserInRole 方法。