Partager via


PermissionSet.IsSubsetOf(PermissionSet) Méthode

Définition

Détermine si le PermissionSet en cours est un sous-ensemble du PermissionSet spécifié.

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

Paramètres

target
PermissionSet

Jeu d’autorisations à tester pour la relation de sous-ensemble. Ce doit être un PermissionSet ou un NamedPermissionSet.

Retours

true si le PermissionSet actuel est une partie du paramètre target ; sinon, false.

Exemples

L’exemple de code suivant montre l’utilisation de la IsSubsetOf méthode . Cet exemple de code fait partie d’un exemple plus grand fourni pour la PermissionSet classe .

// 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))

Remarques

A PermissionSet est un sous-ensemble de la cible PermissionSet si toutes les demandes qui réussissent pour le PermissionSet réussissent également pour la cible. Autrement dit, la cible contient au moins les autorisations contenues dans le sous-ensemble.

S’applique à