[ Team LiB ] Previous Section Next Section

PermissionSetECMA 1.0, serializable

System.Security (mscorlib.dll)class
public class PermissionSet : ISecurityEncodable, ICollection, IEnumerable, IStackWalk, 
     System.Runtime.Serialization.IDeserializationCallback {
// Public Constructors
   public PermissionSet(PermissionSet permSet);
   public PermissionSet(System.Security.Permissions.PermissionState state);
// Public Instance Properties
   public virtual int Count{get;
 // implements ICollection
   public virtual bool IsReadOnly{get; }
   public virtual bool IsSynchronized{get;
 // implements ICollection
   public virtual object SyncRoot{get;
 // implements ICollection
// Public Static Methods
   public static byte[  ] ConvertPermissionSet(string inFormat, byte[  ] inData, string outFormat);
// Public Instance Methods
   public virtual IPermission AddPermission(IPermission perm);
   public virtual void Assert(  );
 // implements IStackWalk
   public bool ContainsNonCodeAccessPermissions(  );
   public virtual PermissionSet Copy(  );
   public virtual void CopyTo(Array array, int index);
 // implements ICollection
   public virtual void Demand(  );
 // implements IStackWalk
   public virtual void Deny(  );
 // implements IStackWalk
   public virtual void FromXml(SecurityElement et);
 // implements ISecurityEncodable
   public virtual IEnumerator GetEnumerator(  );
 // implements IEnumerable
   public virtual IPermission GetPermission(Type permClass);
   public virtual PermissionSet Intersect(PermissionSet other);
   public virtual bool IsEmpty(  );
   public virtual bool IsSubsetOf(PermissionSet target);
   public virtual bool IsUnrestricted(  );
   public virtual void PermitOnly(  );
 // implements IStackWalk
   public virtual IPermission RemovePermission(Type permClass);
   public virtual IPermission SetPermission(IPermission perm);
   public override string ToString(  );
 // overrides object
   public virtual SecurityElement ToXml(  );
 // implements ISecurityEncodable
   public virtual PermissionSet Union(PermissionSet other);
}

The PermissionSet class is a container for groups of IPermission objects. It implements the IStackWalk interface and independently implements the Copy( ), Demand( ), Intersect( ), IsSubsetOf( ), and Union( ) methods, which mirror those defined by the IPermission interface. This functionality allows a PermissionSet object to be treated as an individual IPermission object for imperative security operations, but the security operation is performed on all contained IPermission objects at once.

The contents of a PermissionSet are configured using the AddPermission( ), RemovePermission( ), and SetPermission( ) methods. Only one of each permission type can be present in a PermissionSet at a time. When you call AddPermission( ), if a permission of the same type already exists in the PermissionSet, the existing IPermission is replaced by a new IPermission whose value is calculated as the union of the existing and new IPermission objects. Conversely, SetPermission( ) replaces the existing permission with the specified one. The GetPermission( ) method returns a copy of the IPermission of the specified System.Type if one exists in the PermissionSet.

Subclasses

NamedPermissionSet

Returned By

NamedPermissionSet.Copy( ), System.Security.Permissions.PermissionSetAttribute.CreatePermissionSet( ), System.Security.Policy.PermissionRequestEvidence.{DeniedPermissions, OptionalPermissions, RequestedPermissions}, System.Security.Policy.PolicyStatement.PermissionSet, SecurityManager.ResolvePolicy( )

Passed To

System.AppDomain.DefineDynamicAssembly( ), System.IO.IsolatedStorage.IsolatedStorage.GetPermission( ), System.Reflection.Emit.ConstructorBuilder.AddDeclarativeSecurity( ), System.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity( ), System.Reflection.Emit.TypeBuilder.AddDeclarativeSecurity( ), NamedPermissionSet.NamedPermissionSet( ), System.Security.Policy.PermissionRequestEvidence.PermissionRequestEvidence( ), System.Security.Policy.PolicyLevel.ChangeNamedPermissionSet( ), System.Security.Policy.PolicyStatement.{PermissionSet, PolicyStatement( )}, SecurityManager.ResolvePolicy( ), System.Xml.XmlSecureResolver.XmlSecureResolver( )

    [ Team LiB ] Previous Section Next Section