Bagikan melalui


PermissionSet.IsSubsetOf(PermissionSet) Metode

Definisi

Menentukan apakah saat ini PermissionSet adalah subset dari yang ditentukan PermissionSet.

public:
 bool IsSubsetOf(System::Security::PermissionSet ^ target);
public:
 virtual bool IsSubsetOf(System::Security::PermissionSet ^ target);
public bool IsSubsetOf (System.Security.PermissionSet? target);
public virtual bool IsSubsetOf (System.Security.PermissionSet target);
public bool IsSubsetOf (System.Security.PermissionSet target);
member this.IsSubsetOf : System.Security.PermissionSet -> bool
abstract member IsSubsetOf : System.Security.PermissionSet -> bool
override this.IsSubsetOf : System.Security.PermissionSet -> bool
Public Function IsSubsetOf (target As PermissionSet) As Boolean
Public Overridable Function IsSubsetOf (target As PermissionSet) As Boolean

Parameter

target
PermissionSet

Izin diatur untuk menguji hubungan subset. Ini harus berupa PermissionSet atau NamedPermissionSet.

Mengembalikan

true jika saat ini PermissionSet adalah subset parameter target ; jika tidak, false.

Contoh

Contoh kode berikut menunjukkan penggunaan IsSubsetOf metode . Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk PermissionSet kelas .

// Create a second permission set and compare it to the first permission set.
ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"USERNAME" ) );
ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Write,"COMPUTERNAME" ) );
IEnumerator^ list =  ps1->GetEnumerator();
Console::WriteLine("Permissions in first permission set:");
      while (list->MoveNext())
          Console::WriteLine(list->Current->ToString());
Console::WriteLine( "Second permission IsSubsetOf first permission = {0}", ps2->IsSubsetOf( ps1 ) );
// Create a second permission set and compare it to the first permission set.
ps2.AddPermission(
    new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"));
ps2.AddPermission(
    new EnvironmentPermission(EnvironmentPermissionAccess.Write, "COMPUTERNAME"));
IEnumerator list =  ps1.GetEnumerator();
Console.WriteLine("Permissions in first permission set:");
while (list.MoveNext())
    Console.WriteLine(list.Current.ToString());
Console.WriteLine("Second permission IsSubsetOf first permission = " + ps2.IsSubsetOf(ps1));
' Create a second permission set and compare it to the first permission set.
ps2.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"))
ps2.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Write, "COMPUTERNAME"))
Console.WriteLine("Permissions in first permission set:")
Dim list As IEnumerator = ps1.GetEnumerator()
While list.MoveNext()
    Console.WriteLine(list.Current.ToString())
End While
Console.WriteLine("Second permission IsSubsetOf first permission = " & ps2.IsSubsetOf(ps1))

Keterangan

PermissionSet adalah subset dari target PermissionSet jika semua tuntutan yang berhasil PermissionSet untuk juga berhasil untuk target. Artinya, target berisi setidaknya izin yang terkandung dalam subset.

Berlaku untuk