PermissionSet.IsSubsetOf(PermissionSet) Método

Definición

Determina si el PermissionSet actual es un subconjunto del PermissionSet especificado.

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

Parámetros

target
PermissionSet

Conjunto de permisos para probar la relación del subconjunto. Debe ser un PermissionSet o NamedPermissionSet.

Devoluciones

Es true si el PermissionSet actual es un subconjunto del parámetro target; de lo contrario, es false.

Ejemplos

En el ejemplo de código siguiente se muestra el uso del IsSubsetOf método . Este ejemplo de código es parte de un ejemplo más grande proporcionado para la clase PermissionSet.

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

Comentarios

Un PermissionSet es un subconjunto del destino PermissionSet si todas las demandas que se realizan correctamente para el PermissionSet también se realizan correctamente para el destino. Es decir, el destino contiene al menos los permisos contenidos en el subconjunto.

Se aplica a