mscorlib(4.0.0.0) API with additions
|
Represents a collection that can contain many different types of permissions. More...
Public Member Functions | |
PermissionSet (PermissionState state) | |
Initializes a new instance of the T:System.Security.PermissionSet class with the specified T:System.Security.Permissions.PermissionState. More... | |
PermissionSet (PermissionSet permSet) | |
Initializes a new instance of the T:System.Security.PermissionSet class with initial values taken from the permSet parameter. More... | |
virtual void | CopyTo (Array array, int index) |
Copies the permission objects of the set to the indicated location in an T:System.Array. More... | |
bool | IsEmpty () |
Gets a value indicating whether the T:System.Security.PermissionSet is empty. More... | |
IPermission | GetPermission (Type permClass) |
Gets a permission object of the specified type, if it exists in the set. More... | |
IPermission | SetPermission (IPermission perm) |
Sets a permission to the T:System.Security.PermissionSet, replacing any existing permission of the same type. More... | |
IPermission | AddPermission (IPermission perm) |
Adds a specified permission to the T:System.Security.PermissionSet. More... | |
IPermission | RemovePermission (Type permClass) |
Removes a permission of a certain type from the set. More... | |
bool | IsUnrestricted () |
Determines whether the T:System.Security.PermissionSet is Unrestricted . More... | |
bool | IsSubsetOf (PermissionSet target) |
Determines whether the current T:System.Security.PermissionSet is a subset of the specified T:System.Security.PermissionSet. More... | |
PermissionSet | Intersect (PermissionSet other) |
Creates and returns a permission set that is the intersection of the current T:System.Security.PermissionSet and the specified T:System.Security.PermissionSet. More... | |
PermissionSet | Union (PermissionSet other) |
Creates a T:System.Security.PermissionSet that is the union of the current T:System.Security.PermissionSet and the specified T:System.Security.PermissionSet. More... | |
override bool | Equals (object obj) |
Determines whether the specified T:System.Security.PermissionSet or T:System.Security.NamedPermissionSet object is equal to the current T:System.Security.PermissionSet. More... | |
override int | GetHashCode () |
Gets a hash code for the T:System.Security.PermissionSet object that is suitable for use in hashing algorithms and data structures such as a hash table. More... | |
void | Demand () |
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have not been granted the permissions specified by the current instance. More... | |
void | Assert () |
Declares that the calling code can access the resource protected by a permission demand through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. Using M:System.Security.PermissionSet.Assert can create security vulnerabilities. More... | |
void | Deny () |
Causes any M:System.Security.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 T:System.Security.PermissionSet to fail. More... | |
void | PermitOnly () |
Causes any M:System.Security.PermissionSet.Demand that passes through the calling code for any T:System.Security.PermissionSet that is not a subset of the current T:System.Security.PermissionSet to fail. More... | |
virtual PermissionSet | Copy () |
Creates a copy of the T:System.Security.PermissionSet. More... | |
IEnumerator | GetEnumerator () |
Returns an enumerator for the permissions of the set. More... | |
override string | ToString () |
Returns a string representation of the T:System.Security.PermissionSet. More... | |
virtual void | FromXml (SecurityElement et) |
Reconstructs a security object with a specified state from an XML encoding. More... | |
virtual SecurityElement | ToXml () |
Creates an XML encoding of the security object and its current state. More... | |
bool | ContainsNonCodeAccessPermissions () |
Gets a value indicating whether the T:System.Security.PermissionSet contains permissions that are not derived from T:System.Security.CodeAccessPermission. More... | |
Static Public Member Functions | |
static byte [] | ConvertPermissionSet (string inFormat, byte[] inData, string outFormat) |
Converts an encoded T:System.Security.PermissionSet from one XML encoding format to another XML encoding format. More... | |
static void | RevertAssert () |
Causes any previous M:System.Security.CodeAccessPermission.Assert for the current frame to be removed and no longer be in effect. More... | |
Public Attributes | |
virtual object | SyncRoot => this |
Gets the root object of the current collection. More... | |
virtual bool | IsSynchronized => false |
Gets a value indicating whether the collection is guaranteed to be thread safe. More... | |
virtual bool | IsReadOnly => false |
Gets a value indicating whether the collection is read-only. More... | |
Protected Member Functions | |
virtual IPermission | GetPermissionImpl (Type permClass) |
Gets a permission object of the specified type, if it exists in the set. More... | |
virtual IPermission | SetPermissionImpl (IPermission perm) |
Sets a permission to the T:System.Security.PermissionSet, replacing any existing permission of the same type. More... | |
virtual IPermission | AddPermissionImpl (IPermission perm) |
Adds a specified permission to the T:System.Security.PermissionSet. More... | |
virtual IPermission | RemovePermissionImpl (Type permClass) |
Removes a permission of a certain type from the set. More... | |
virtual IEnumerator | GetEnumeratorImpl () |
Returns an enumerator for the permissions of the set. More... | |
Properties | |
virtual int | Count [get] |
Gets the number of permission objects contained in the permission set. More... | |
![]() | |
int | Count [get] |
Gets the number of elements contained in the T:System.Collections.ICollection. More... | |
object | SyncRoot [get] |
Gets an object that can be used to synchronize access to the T:System.Collections.ICollection. More... | |
bool | IsSynchronized [get] |
Gets a value indicating whether access to the T:System.Collections.ICollection is synchronized (thread safe). More... | |
Represents a collection that can contain many different types of permissions.
Definition at line 20 of file PermissionSet.cs.
System.Security.PermissionSet.PermissionSet | ( | PermissionState | state | ) |
Initializes a new instance of the T:System.Security.PermissionSet class with the specified T:System.Security.Permissions.PermissionState.
state | One of the enumeration values that specifies the permission set's access to resources. |
T:System.ArgumentException | The state parameter is not a valid T:System.Security.Permissions.PermissionState. |
Definition at line 202 of file PermissionSet.cs.
System.Security.PermissionSet.PermissionSet | ( | PermissionSet | permSet | ) |
Initializes a new instance of the T:System.Security.PermissionSet class with initial values taken from the permSet parameter.
permSet | The set from which to take the value of the new T:System.Security.PermissionSet, or null to create an empty T:System.Security.PermissionSet. |
Definition at line 220 of file PermissionSet.cs.
IPermission System.Security.PermissionSet.AddPermission | ( | IPermission | perm | ) |
Adds a specified permission to the T:System.Security.PermissionSet.
perm | The permission to add. |
T:System.InvalidOperationException | The method is called from a T:System.Security.ReadOnlyPermissionSet. |
Definition at line 433 of file PermissionSet.cs.
|
protectedvirtual |
Adds a specified permission to the T:System.Security.PermissionSet.
perm | The permission to add. |
null
if perm is null
.T:System.InvalidOperationException | The method is called from a T:System.Security.ReadOnlyPermissionSet. |
Reimplemented in System.Security.ReadOnlyPermissionSet.
Definition at line 442 of file PermissionSet.cs.
void System.Security.PermissionSet.Assert | ( | ) |
Declares that the calling code can access the resource protected by a permission demand through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. Using M:System.Security.PermissionSet.Assert can create security vulnerabilities.
T:System.Security.SecurityException | The T:System.Security.PermissionSet instance asserted has not been granted to the asserting code.-or- There is already an active M:System.Security.PermissionSet.Assert for the current frame. |
Implements System.Security.IStackWalk.
Definition at line 1365 of file PermissionSet.cs.
bool System.Security.PermissionSet.ContainsNonCodeAccessPermissions | ( | ) |
Gets a value indicating whether the T:System.Security.PermissionSet contains permissions that are not derived from T:System.Security.CodeAccessPermission.
true
if the T:System.Security.PermissionSet contains permissions that are not derived from T:System.Security.CodeAccessPermission; otherwise, false
.Definition at line 1942 of file PermissionSet.cs.
|
static |
Converts an encoded T:System.Security.PermissionSet from one XML encoding format to another XML encoding format.
inFormat | A string representing one of the following encoding formats: ASCII, Unicode, or Binary. Possible values are "XMLASCII" or "XML", "XMLUNICODE", and "BINARY". |
inData | An XML-encoded permission set. |
outFormat | A string representing one of the following encoding formats: ASCII, Unicode, or Binary. Possible values are "XMLASCII" or "XML", "XMLUNICODE", and "BINARY". |
T:System.NotImplementedException | In all cases. |
Definition at line 1934 of file PermissionSet.cs.
|
virtual |
Creates a copy of the T:System.Security.PermissionSet.
Reimplemented in System.Security.NamedPermissionSet, and System.Security.ReadOnlyPermissionSet.
Definition at line 1403 of file PermissionSet.cs.
|
virtual |
Copies the permission objects of the set to the indicated location in an T:System.Array.
array | The target array to which to copy. |
index | The starting position in the array to begin copying (zero based). |
T:System.ArgumentNullException | The array parameter is null . |
T:System.ArgumentException | The array parameter has more than one dimension. |
T:System.IndexOutOfRangeException | The index parameter is out of the range of the array parameter. |
Implements System.Collections.ICollection.
Definition at line 260 of file PermissionSet.cs.
void System.Security.PermissionSet.Demand | ( | ) |
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have not been granted the permissions specified by the current instance.
T:System.Security.SecurityException | A caller in the call chain does not have the permission demanded. |
Implements System.Security.IStackWalk.
Definition at line 1325 of file PermissionSet.cs.
void System.Security.PermissionSet.Deny | ( | ) |
Causes any M:System.Security.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 T:System.Security.PermissionSet to fail.
T:System.Security.SecurityException | A previous call to M:System.Security.PermissionSet.Deny has already restricted the permissions for the current stack frame. |
Implements System.Security.IStackWalk.
Definition at line 1376 of file PermissionSet.cs.
override bool System.Security.PermissionSet.Equals | ( | object | obj | ) |
Determines whether the specified T:System.Security.PermissionSet or T:System.Security.NamedPermissionSet object is equal to the current T:System.Security.PermissionSet.
obj | The object to compare with the current T:System.Security.PermissionSet. |
true
if the specified object is equal to the current T:System.Security.PermissionSet object; otherwise, false
.Definition at line 1253 of file PermissionSet.cs.
|
virtual |
Reconstructs a security object with a specified state from an XML encoding.
et | The XML encoding to use to reconstruct the security object. |
T:System.ArgumentNullException | The et parameter is null . |
T:System.ArgumentException | The et parameter is not a valid permission element.-or- The et parameter's version number is not supported. |
Implements System.Security.ISecurityEncodable.
Reimplemented in System.Security.NamedPermissionSet, and System.Security.ReadOnlyPermissionSet.
Definition at line 1517 of file PermissionSet.cs.
IEnumerator System.Security.PermissionSet.GetEnumerator | ( | ) |
Returns an enumerator for the permissions of the set.
Implements System.Collections.IEnumerable.
Definition at line 1421 of file PermissionSet.cs.
|
protectedvirtual |
Returns an enumerator for the permissions of the set.
Reimplemented in System.Security.ReadOnlyPermissionSet.
Definition at line 1428 of file PermissionSet.cs.
override int System.Security.PermissionSet.GetHashCode | ( | ) |
Gets a hash code for the T:System.Security.PermissionSet object that is suitable for use in hashing algorithms and data structures such as a hash table.
Definition at line 1302 of file PermissionSet.cs.
IPermission System.Security.PermissionSet.GetPermission | ( | Type | permClass | ) |
Gets a permission object of the specified type, if it exists in the set.
permClass | The type of the desired permission object. |
null
if none exists.Definition at line 381 of file PermissionSet.cs.
|
protectedvirtual |
Gets a permission object of the specified type, if it exists in the set.
permClass | The type of the permission object. |
null
if none exists.Reimplemented in System.Security.ReadOnlyPermissionSet.
Definition at line 389 of file PermissionSet.cs.
PermissionSet System.Security.PermissionSet.Intersect | ( | PermissionSet | other | ) |
Creates and returns a permission set that is the intersection of the current T:System.Security.PermissionSet and the specified T:System.Security.PermissionSet.
other | A permission set to intersect with the current T:System.Security.PermissionSet. |
null
if the intersection is empty.Definition at line 879 of file PermissionSet.cs.
bool System.Security.PermissionSet.IsEmpty | ( | ) |
Gets a value indicating whether the T:System.Security.PermissionSet is empty.
true
if the T:System.Security.PermissionSet is empty; otherwise, false
.Definition at line 301 of file PermissionSet.cs.
bool System.Security.PermissionSet.IsSubsetOf | ( | PermissionSet | target | ) |
Determines whether the current T:System.Security.PermissionSet is a subset of the specified T:System.Security.PermissionSet.
target | The permission set to test for the subset relationship. This must be either a T:System.Security.PermissionSet or a T:System.Security.NamedPermissionSet. |
true
if the current T:System.Security.PermissionSet is a subset of the target parameter; otherwise, false
.Definition at line 604 of file PermissionSet.cs.
bool System.Security.PermissionSet.IsUnrestricted | ( | ) |
Determines whether the T:System.Security.PermissionSet is Unrestricted
.
true
if the T:System.Security.PermissionSet is Unrestricted
; otherwise, false
.Definition at line 519 of file PermissionSet.cs.
void System.Security.PermissionSet.PermitOnly | ( | ) |
Causes any M:System.Security.PermissionSet.Demand that passes through the calling code for any T:System.Security.PermissionSet that is not a subset of the current T:System.Security.PermissionSet to fail.
Implements System.Security.IStackWalk.
Definition at line 1385 of file PermissionSet.cs.
IPermission System.Security.PermissionSet.RemovePermission | ( | Type | permClass | ) |
Removes a permission of a certain type from the set.
permClass | The type of permission to delete. |
T:System.InvalidOperationException | The method is called from a T:System.Security.ReadOnlyPermissionSet. |
Definition at line 484 of file PermissionSet.cs.
|
protectedvirtual |
Removes a permission of a certain type from the set.
permClass | The type of the permission to remove. |
T:System.InvalidOperationException | The method is called from a T:System.Security.ReadOnlyPermissionSet. |
Reimplemented in System.Security.ReadOnlyPermissionSet.
Definition at line 493 of file PermissionSet.cs.
|
static |
Causes any previous M:System.Security.CodeAccessPermission.Assert for the current frame to be removed and no longer be in effect.
T:System.InvalidOperationException | There is no previous M:System.Security.CodeAccessPermission.Assert for the current frame. |
Definition at line 2147 of file PermissionSet.cs.
IPermission System.Security.PermissionSet.SetPermission | ( | IPermission | perm | ) |
Sets a permission to the T:System.Security.PermissionSet, replacing any existing permission of the same type.
perm | The permission to set. |
T:System.InvalidOperationException | The method is called from a T:System.Security.ReadOnlyPermissionSet. |
Definition at line 402 of file PermissionSet.cs.
|
protectedvirtual |
Sets a permission to the T:System.Security.PermissionSet, replacing any existing permission of the same type.
perm | The permission to set. |
T:System.InvalidOperationException | The method is called from a T:System.Security.ReadOnlyPermissionSet. |
Reimplemented in System.Security.ReadOnlyPermissionSet.
Definition at line 411 of file PermissionSet.cs.
override string System.Security.PermissionSet.ToString | ( | ) |
Returns a string representation of the T:System.Security.PermissionSet.
Definition at line 1440 of file PermissionSet.cs.
|
virtual |
Creates an XML encoding of the security object and its current state.
Implements System.Security.ISecurityEncodable.
Reimplemented in System.Security.NamedPermissionSet, and System.Security.ReadOnlyPermissionSet.
Definition at line 1909 of file PermissionSet.cs.
PermissionSet System.Security.PermissionSet.Union | ( | PermissionSet | other | ) |
Creates a T:System.Security.PermissionSet that is the union of the current T:System.Security.PermissionSet and the specified T:System.Security.PermissionSet.
other | The permission set to form the union with the current T:System.Security.PermissionSet. |
Definition at line 1101 of file PermissionSet.cs.
virtual bool System.Security.PermissionSet.IsReadOnly => false |
Gets a value indicating whether the collection is read-only.
false
.Definition at line 93 of file PermissionSet.cs.
virtual bool System.Security.PermissionSet.IsSynchronized => false |
Gets a value indicating whether the collection is guaranteed to be thread safe.
false
.Definition at line 89 of file PermissionSet.cs.
virtual object System.Security.PermissionSet.SyncRoot => this |
Gets the root object of the current collection.
Definition at line 85 of file PermissionSet.cs.
|
get |
Gets the number of permission objects contained in the permission set.
Definition at line 98 of file PermissionSet.cs.