다음을 통해 공유


CryptoProvider.BoundGrants 속성

정의

확인 과정을 거쳐 사용자에게 부여된 권한을 나열하는 컬렉션을 가져옵니다.

public:
 property System::Collections::ObjectModel::ReadOnlyCollection<System::Security::RightsManagement::ContentGrant ^> ^ BoundGrants { System::Collections::ObjectModel::ReadOnlyCollection<System::Security::RightsManagement::ContentGrant ^> ^ get(); };
public System.Collections.ObjectModel.ReadOnlyCollection<System.Security.RightsManagement.ContentGrant> BoundGrants { get; }
member this.BoundGrants : System.Collections.ObjectModel.ReadOnlyCollection<System.Security.RightsManagement.ContentGrant>
Public ReadOnly Property BoundGrants As ReadOnlyCollection(Of ContentGrant)

속성 값

ReadOnlyCollection<ContentGrant>

확인 과정을 거쳐 사용자에게 부여된 권한을 열거하는 컬렉션입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 BoundGrants 속성을 통해 부여 된 권한 목록을 가져올는 UseLicense합니다.

ShowStatus("   Binding UseLicense with the SecureEnvironment" +
         "\n       to obtain the CryptoProvider.");
CryptoProvider cryptoProvider = useLicense.Bind(_secureEnv);

ShowStatus("   Obtaining BoundGrants.");
ReadOnlyCollection<ContentGrant> grants =
    cryptoProvider.BoundGrants;

rightsBlockTitle.Text = "Rights - " + Filename(useLicenseFile);
rightsBlock.Text = "GRANTS LIST\n-----------------\n";
foreach (ContentGrant grant in grants)
{
    rightsBlock.Text += "USER:  " + grant.User.Name + " [" +
        grant.User.AuthenticationType + "]\n";
    rightsBlock.Text += "RIGHT: " + grant.Right.ToString() + "\n";
    rightsBlock.Text += "    From:  " + grant.ValidFrom + "\n";
    rightsBlock.Text += "    Until: " + grant.ValidUntil + "\n";
}

if (cryptoProvider.CanDecrypt == true)
    ShowStatus("   Decryption granted.");
else
    ShowStatus("   CANNOT DECRYPT!");
ShowStatus("   Binding UseLicense with the SecureEnvironment" & vbLf & "       to obtain the CryptoProvider.")
Dim cryptoProvider As CryptoProvider = useLicense.Bind(_secureEnv)

ShowStatus("   Obtaining BoundGrants.")
Dim grants As ReadOnlyCollection(Of ContentGrant) = cryptoProvider.BoundGrants

rightsBlockTitle.Text = "Rights - " & Filename(useLicenseFile)
rightsBlock.Text = "GRANTS LIST" & vbLf & "-----------------" & vbLf
For Each grant As ContentGrant In grants
    rightsBlock.Text &= "USER:  " & grant.User.Name & " [" & grant.User.AuthenticationType & "]" & vbLf
    rightsBlock.Text &= "RIGHT: " & grant.Right.ToString() & vbLf
    rightsBlock.Text &= "    From:  " & grant.ValidFrom & vbLf
    rightsBlock.Text &= "    Until: " & grant.ValidUntil & vbLf
Next grant

If cryptoProvider.CanDecrypt = True Then
    ShowStatus("   Decryption granted.")
Else
    ShowStatus("   CANNOT DECRYPT!")
End If

적용 대상