[Serializable] |
ctor #1 | Overloaded:.ctor(PermissionSet permSet) Initializes a new instance of the PermissionSet class with initial values taken from the permSet parameter. |
ctor #2 | Overloaded:.ctor(PermissionState state) Initializes a new instance of the PermissionSet class with the specified PermissionState. |
Count | Read-only Gets the number of permission objects contained in the permission set. |
IsReadOnly | Read-only Gets a value indicating whether the collection is read-only. |
IsSynchronized | Read-only Gets a value indicating whether the collection is guaranteed to be thread safe. |
SyncRoot | Read-only Gets the root object of the current collection. |
AddPermission | Adds a specified permission to the PermissionSet. |
Assert | Asserts that the calling code can access the resource contained in the set through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. |
ContainsNonCodeAccessPermissions | Gets a value indicating whether the PermissionSet contains permissions that are not derived from CodeAccessPermission. |
ConvertPermissionSet | This method is for internal use only. |
Copy | Creates a copy of the PermissionSet. |
CopyTo | Copies the permission objects of the set to the indicated location in an Array. |
Demand | Forces a SecurityException at run time if all callers higher in the call stack have not been granted the permissions specified by the current instance. |
Deny | Causes any PermissionSet.Demand that passes through the calling code for a permission that has an intersection with a permission of a type contained in the current PermissionSet to fail. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
FromXml | Reconstructs a security object with a specified state from an XML encoding. |
GetEnumerator | Returns an enumerator for the permissions of the set. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetPermission | Gets a permission object of the specified type, if it exists in the set. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
Intersect | Creates and returns a permission that is the intersection of the current PermissionSet and the specified PermissionSet. |
IsEmpty | Gets a value indicating whether the PermissionSet is empty. |
IsSubsetOf | Determines whether the current PermissionSet is a subset of the specified PermissionSet. |
IsUnrestricted | Determines whether the PermissionSet is Unrestricted. |
PermitOnly | Causes any PermissionSet.Demand that passes through the calling code for any PermissionSet that is not a subset of the current PermissionSet to fail. |
RemovePermission | Removes a permission of a certain type from the set. |
SetPermission | Sets a permission to the PermissionSet, replacing any existing permission of the same type. |
ToString | Overridden: Returns a string representation of the PermissionSet. |
ToXml | Creates an XML encoding of the security object and its current state. |
Union | Creates a PermissionSet that is the union of the current PermissionSet and the specified PermissionSet. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public PermissionSet(PermissionSet( |
permSet
Exception Type | Condition |
---|---|
ArgumentException | The permSet parameter is not null and is not a PermissionSet object. |
public PermissionSet( |
state
Exception Type | Condition |
---|---|
ArgumentException | The state parameter is not a valid PermissionState. |
Use PermissionSet.AddPermission on an empty PermissionSet to define the set in greater detail.
public virtual int Count {get;}
|
public virtual bool IsReadOnly {get;}
|
public virtual bool IsSynchronized {get;}
|
This method is required to support ICollection.
public virtual object SyncRoot {get;}
|
public virtual IPermission AddPermission( |
perm
Exception Type | Condition |
---|---|
ArgumentException | The perm parameter is not a permission object. |
public virtual void Assert(); |
Exception Type | Condition |
---|---|
SecurityException | The PermissionSet instance asserted has not been granted to the asserting code. |
public bool ContainsNonCodeAccessPermissions(); |
public static byte[] ConvertPermissionSet( |
inFormat
inData
outFormat
public virtual PermissionSet Copy(); |
array
index
Exception Type | Condition |
---|---|
ArgumentException | The index parameter is out of the range of the array parameter. |
ArgumentNullException | The array parameter is null. |
public virtual void Demand(); |
Exception Type | Condition |
---|---|
SecurityException | A caller in the call chain does not have the permission demanded. |
The permissions of the code that calls this method are not examined; the check begins from the immediate caller of that code and proceeds up the stack. The call stack is typically represented as growing down, so that methods higher in the call stack call methods lower in the call stack. PermissionSet.Demand succeeds only if no SecurityException is thrown.
If the PermissionSet contains permissions that do not inherit from CodeAccessPermission, the Demand methods of those permissions are called as well.
public virtual void Deny(); |
PermissionSet.Deny can limit the liability of the programmer or prevent accidental security vulnerabilities because it prevents the method that calls PermissionSet.Deny from being used to access the resource protected by the denied permission. If a method calls PermissionSet.Deny on a permission, and if a PermissionSet.Demand for that permission is invoked by a caller lower in the call stack, that security check fails when it reaches the PermissionSet.Deny.
PermissionSet.Deny is ignored for a permission that is not granted because a demand for that permission cannot succeed.
~PermissionSet(); |
public virtual void FromXml( |
et
public virtual IEnumerator GetEnumerator(); |
public virtual int GetHashCode(); |
public virtual IPermission GetPermission( |
permClass
public Type GetType(); |
public virtual PermissionSet Intersect( |
other
For each type of permission that is present in both sets, the two instances of those permissions are intersected using the permission's Intersect method; the resulting permission is included in the resulting PermissionSet. Permission types that exist in only one of the two sets are excluded from the resulting set.
public virtual bool IsEmpty(); |
public virtual bool IsSubsetOf( |
target
public virtual bool IsUnrestricted(); |
protected object MemberwiseClone(); |
public virtual void PermitOnly(); |
PermissionSet.PermitOnly is ignored for a permission not granted because a demand for that permission cannot succeed. However, if code lower on the call stack later calls PermissionSet.Demand for that permission, a SecurityException is thrown when the stack walk reaches the code that tried to call PermissionSet.PermitOnly. This is because the code that called PermissionSet.PermitOnly has not been granted the permission, even though it called PermissionSet.PermitOnly for that permission. The call stack is typically represented as growing down, so that methods higher in the call stack call methods lower in the call stack.
public virtual IPermission RemovePermission( |
permClass
public virtual IPermission SetPermission( |
perm
public override string ToString(); |
public virtual SecurityElement ToXml(); |
public virtual PermissionSet Union( |
other