SecureEnvironment.IsUserActivated(ContentUser) メソッド

定義

権限が管理されているコンテンツにアクセスするために、特定のユーザーがアクティブ化されているかどうかを示します。

public:
 static bool IsUserActivated(System::Security::RightsManagement::ContentUser ^ user);
public static bool IsUserActivated(System.Security.RightsManagement.ContentUser user);
static member IsUserActivated : System.Security.RightsManagement.ContentUser -> bool
Public Shared Function IsUserActivated (user As ContentUser) As Boolean

パラメーター

user
ContentUser

権限が管理されたコンテンツへのアクセスを許可するユーザーまたはユーザー グループ。

返品

true 権限管理コンテンツにアクセスするために特定の user がアクティブ化されている場合は ゚。それ以外の場合は false

次の例は、 IsUserActivated メソッドを使用して、権限が管理されたコンテンツへのアクセスが特定のユーザーに許可されているかどうかを判断する方法を示しています。

string applicationManifest = "<manifest></manifest>";
if (File.Exists("rpc.xml"))
{
    StreamReader manifestReader = File.OpenText("rpc.xml");
    applicationManifest = manifestReader.ReadToEnd();
}

if (_secureEnv == null)
{
    if (SecureEnvironment.IsUserActivated(new ContentUser(
                _currentUserId, AuthenticationType.Windows)))
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest, new ContentUser(
                _currentUserId, AuthenticationType.Windows));
    }
    else
    {
        _secureEnv = SecureEnvironment.Create(
            applicationManifest,
            AuthenticationType.Windows,
            UserActivationMode.Permanent);
    }
}
Dim applicationManifest As String = "<manifest></manifest>"
If File.Exists("rpc.xml") Then
    Dim manifestReader As StreamReader = File.OpenText("rpc.xml")
    applicationManifest = manifestReader.ReadToEnd()
End If

If _secureEnv Is Nothing Then
    If SecureEnvironment.IsUserActivated(New ContentUser(_currentUserId, AuthenticationType.Windows)) Then
        _secureEnv = SecureEnvironment.Create(applicationManifest, New ContentUser(_currentUserId, AuthenticationType.Windows))
    Else
        _secureEnv = SecureEnvironment.Create(applicationManifest, AuthenticationType.Windows, UserActivationMode.Permanent)
    End If
End If

適用対象