PermissionSet Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
Code Access Security is not supported or honored by the runtime.
Represents a collection that can contain many different types of permissions.
public ref class PermissionSet : System::Collections::ICollection, System::Runtime::Serialization::IDeserializationCallback, System::Security::ISecurityEncodable, System::Security::IStackWalk
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
[System.Serializable]
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class PermissionSet : System.Collections.ICollection, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type PermissionSet = class
interface ICollection
interface IEnumerable
interface IDeserializationCallback
interface ISecurityEncodable
interface IStackWalk
type PermissionSet = class
interface ICollection
interface IEnumerable
interface IDeserializationCallback
interface ISecurityEncodable
interface IStackWalk
[<System.Serializable>]
type PermissionSet = class
interface ISecurityEncodable
interface ICollection
interface IEnumerable
interface IStackWalk
interface IDeserializationCallback
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PermissionSet = class
interface ISecurityEncodable
interface ICollection
interface IEnumerable
interface IStackWalk
interface IDeserializationCallback
Public Class PermissionSet
Implements ICollection, IDeserializationCallback, ISecurityEncodable, IStackWalk
- Inheritance
-
PermissionSet
- Derived
- Attributes
- Implements
Remarks
Caution
Code Access Security (CAS) has been deprecated across all versions of .NET Framework and .NET. Recent versions of .NET do not honor CAS annotations and produce errors if CAS-related APIs are used. Developers should seek alternative means of accomplishing security tasks.
You can use PermissionSet to perform operations on several different permissions as a group.
Constructors
PermissionSet(PermissionSet) |
Initializes a new instance of the PermissionSet class with initial values taken from the |
PermissionSet(PermissionState) |
Initializes a new instance of the PermissionSet class with the specified PermissionState. |
Properties
Count |
Gets the number of permission objects contained in the permission set. |
IsReadOnly |
Gets a value indicating whether the collection is read-only. |
IsSynchronized |
Gets a value indicating whether the collection is guaranteed to be thread safe. |
SyncRoot |
Gets the root object of the current collection. |
Methods
AddPermission(IPermission) |
Adds a specified permission to the PermissionSet. |
AddPermissionImpl(IPermission) |
Adds a specified permission to the 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 Assert() can create security vulnerabilities. |
ContainsNonCodeAccessPermissions() |
Gets a value indicating whether the PermissionSet contains permissions that are not derived from CodeAccessPermission. |
ConvertPermissionSet(String, Byte[], String) |
Obsolete.
Obsolete.
Converts an encoded PermissionSet from one XML encoding format to another XML encoding format. |
Copy() |
Creates a copy of the PermissionSet. |
CopyTo(Array, Int32) |
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() |
Obsolete.
Obsolete.
Causes any 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(Object) |
Determines whether the specified PermissionSet or NamedPermissionSet object is equal to the current PermissionSet. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
FromXml(SecurityElement) |
Reconstructs a security object with a specified state from an XML encoding. |
GetEnumerator() |
Returns an enumerator for the permissions of the set. |
GetEnumeratorImpl() |
Returns an enumerator for the permissions of the set. |
GetHashCode() |
Gets a hash code for the PermissionSet object that is suitable for use in hashing algorithms and data structures such as a hash table. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetPermission(Type) |
Gets a permission object of the specified type, if it exists in the set. |
GetPermissionImpl(Type) |
Gets a permission object of the specified type, if it exists in the set. |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
Intersect(PermissionSet) |
Creates and returns a permission set that is the intersection of the current PermissionSet and the specified PermissionSet. |
IsEmpty() |
Gets a value indicating whether the PermissionSet is empty. |
IsSubsetOf(PermissionSet) |
Determines whether the current PermissionSet is a subset of the specified PermissionSet. |
IsUnrestricted() |
Determines whether the PermissionSet is |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
PermitOnly() |
Causes any Demand() that passes through the calling code for any PermissionSet that is not a subset of the current PermissionSet to fail. |
RemovePermission(Type) |
Removes a permission of a certain type from the set. |
RemovePermissionImpl(Type) |
Removes a permission of a certain type from the set. |
RevertAssert() |
Causes any previous Assert() for the current frame to be removed and no longer be in effect. |
SetPermission(IPermission) |
Sets a permission to the PermissionSet, replacing any existing permission of the same type. |
SetPermissionImpl(IPermission) |
Sets a permission to the PermissionSet, replacing any existing permission of the same type. |
ToString() |
Returns a string representation of the PermissionSet. |
ToXml() |
Creates an XML encoding of the security object and its current state. |
Union(PermissionSet) |
Creates a PermissionSet that is the union of the current PermissionSet and the specified PermissionSet. |
Explicit Interface Implementations
IDeserializationCallback.OnDeserialization(Object) |
Runs when the entire object graph has been deserialized. |
Extension Methods
Cast<TResult>(IEnumerable) |
Casts the elements of an IEnumerable to the specified type. |
OfType<TResult>(IEnumerable) |
Filters the elements of an IEnumerable based on a specified type. |
AsParallel(IEnumerable) |
Enables parallelization of a query. |
AsQueryable(IEnumerable) |
Converts an IEnumerable to an IQueryable. |