Share via


DirectoryServicesPermission

The DirectoryServicesPermission class allows control of code access security permissions for System.DirectoryServices.

The DirectoryServicesPermission class is derived from the System.Security.Permissions.ResourcePermissionBase class.

Public Constructors

The DirectoryServicesPermission class has the following public constructors.

Constructor Description
DirectoryServicesPermission()

Overloaded. Initializes a new instance of the DirectoryServicesPermission class.

DirectoryServicesPermission(DirectoryServicesPermissionAccess, String)

Overloaded. Initializes a new instance of the DirectoryServicesPermission class.

DirectoryServicesPermission(DirectoryServicesPermissionEntry[])

Overloaded. Initializes a new instance of the DirectoryServicesPermission class.

DirectoryServicesPermission(PermissionState)

Overloaded. Initializes a new instance of the DirectoryServicesPermission class.

Public Methods

The DirectoryServicesPermission class has the following public methods.

Method Description
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.

Copy()

Overridden. Creates and returns an identical copy of the current permission object.

Demand()

Forces a SecurityException at run time if all callers higher in the call stack have not been granted the permission specified by the current instance.

Deny()

Prevents callers higher in the call stack from using the code that calls this method to access the resource specified by the current instance.

Equals(Object)

Overloaded. Determines whether the specified Object is equal to the current Object.

FromXml(SecurityElement)

Overridden. Reconstructs a security object with a specified state from an XML encoding.

GetHashCode()

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

GetType()

Gets the Type of the current instance.

Intersect(IPermission)

Overridden. Creates and returns a permission object that is the intersection of the current permission object and a target permission object.

IsSubsetOf(IPermission)

Overridden. Determines whether the current permission object is a subset of the specified permission.

IsUnrestricted()

Gets a value indicating whether the permission is unrestricted.

PermitOnly()

Prevents callers higher in the call stack from using the code that calls this method to access all resources except for the resource specified by the current instance.

ToString()

Creates and returns a string representation of the current permission object.

ToXml()

Overridden. Creates and returns an XML encoding of the security object and its current state.

Union(IPermission)

Overridden. Creates a permission object that combines the current permission object and the target permission object.

Public Properties

The DirectoryServicesPermission class has the following public properties.

Property Description
PermissionEntries Data type: DirectoryServicesPermissionEntryCollection
Access type: Read-only

Gets the collection of permission entries for this permission.

Protected Methods

The DirectoryServicesPermission class has the following protected methods.

Method Description
AddPermissionAccess(ResourcePermissionBaseEntry)

Adds a permission entry to the permission.

Clear()

Clears the permission of the added permission entries.

Finalize()

Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.

GetPermissionEntries()

Returns an array of ResourcePermissionBaseEntry objects added to this permission.

MemberwiseClone()

Creates a shallow copy of the current Object.

RemovePermissionAccess(ResourcePermissionBaseEntry)

Removes a permission entry from the permission.

Protected Properties

The DirectoryServicesPermission class has the following protected properties.

Property Description
PermissionAccessType Data type: Type
Access type: Read/write

Gets or sets an enumeration value that describes the types of access that you are giving the resource.

TagNames Data type: String array
Access type: Read/write

Gets or sets an array of strings that identify the resource you are protecting.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Requirements

Client Requires Windows XP Home Edition, Windows XP Professional, Windows Me, or Windows 98.
Server Requires Windows Server 2003, Windows 2000, or Windows NT 4.0.
Namespace

Defined in System.DirectoryServices.

Assembly

Requires System.DirectoryServices (in System.DirectoryServices.dll).

.NET Framework

Requires .NET Framework 1.0.

See Also

DirectoryServicesPermission Constructors, DirectoryServicesPermission Properties, DirectoryServicesPermissionAttribute, DirectoryServicesPermissionEntry, DirectoryServicesPermissionEntryCollection, DirectoryServicesPermission Members (Visual J# Syntax), System.DirectoryServices Namespace, Managed Extensions for C++ Programming