Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Security.​AccessControl.​NativeObjectSecurity

Assembly: System.Security.AccessControl

Inheritance: object → ObjectSecurityCommonObjectSecurity → NativeObjectSecurity

Provides the ability to control access to native objects without direct manipulation of Access Control Lists (ACLs). Native object types are defined by the <see cref="T:System.Security.AccessControl.ResourceType" /> enumeration.

Properties

public Type
AccessRightType
Gets the <see cref="T:System.Type" /> of the securable object associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object.
protected bool
AccessRulesModified
Gets or sets a Boolean value that specifies whether the access rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object have been modified.
public Type
AccessRuleType
Gets the <see cref="T:System.Type" /> of the object associated with the access rules of this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object. The <see cref="T:System.Type" /> object must be an object that can be cast as a <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
public bool
AreAccessRulesCanonical
Gets a Boolean value that specifies whether the access rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object are in canonical order.
public bool
AreAccessRulesProtected
Gets a Boolean value that specifies whether the Discretionary Access Control List (DACL) associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object is protected.
public bool
AreAuditRulesCanonical
Gets a Boolean value that specifies whether the audit rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object are in canonical order.
public bool
AreAuditRulesProtected
Gets a Boolean value that specifies whether the System Access Control List (SACL) associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object is protected.
protected bool
AuditRulesModified
Gets or sets a Boolean value that specifies whether the audit rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object have been modified.
public Type
AuditRuleType
Gets the <see cref="T:System.Type" /> object associated with the audit rules of this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object. The <see cref="T:System.Type" /> object must be an object that can be cast as a <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
protected bool
GroupModified
Gets or sets a Boolean value that specifies whether the group associated with the securable object has been modified.
protected bool
IsContainer
Gets a Boolean value that specifies whether this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object is a container object.
protected bool
IsDS
Gets a Boolean value that specifies whether this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object is a directory object.
protected bool
OwnerModified
Gets or sets a Boolean value that specifies whether the owner of the securable object has been modified.
SecurityDescriptor
Gets the security descriptor for this instance.

Methods

protected void
Persist​(Runtime.​InteropServices.​SafeHandle handle, AccessControlSections includeSections)
Saves the specified sections of the security descriptor associated with this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object to permanent storage. We recommend.persist that the values of the <paramref name="includeSections" /> parameters passed to the constructor and persist methods be identical.
handle The handle of the securable object with which this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object is associated.
includeSections One of the <see cref="T:System.Security.AccessControl.AccessControlSections" /> enumeration values that specifies the sections of the security descriptor (access rules, audit rules, owner, primary group) of the securable object to save.
protected void
Persist​(Runtime.​InteropServices.​SafeHandle handle, AccessControlSections includeSections, object exceptionContext)
Saves the specified sections of the security descriptor associated with this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object to permanent storage. We recommend that the values of the <paramref name="includeSections" /> parameters passed to the constructor and persist methods be identical.
handle The handle of the securable object with which this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object is associated.
includeSections One of the <see cref="T:System.Security.AccessControl.AccessControlSections" /> enumeration values that specifies the sections of the security descriptor (access rules, audit rules, owner, primary group) of the securable object to save.
exceptionContext An object that contains contextual information about the source or destination of the exception.
protected void
Persist​(string name, AccessControlSections includeSections)
Saves the specified sections of the security descriptor associated with this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object to permanent storage. We recommend that the values of the <paramref name="includeSections" /> parameters passed to the constructor and persist methods be identical.
name The name of the securable object with which this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object is associated.
includeSections One of the <see cref="T:System.Security.AccessControl.AccessControlSections" /> enumeration values that specifies the sections of the security descriptor (access rules, audit rules, owner, primary group) of the securable object to save.
protected void
Persist​(string name, AccessControlSections includeSections, object exceptionContext)
Saves the specified sections of the security descriptor associated with this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object to permanent storage. We recommend that the values of the <paramref name="includeSections" /> parameters passed to the constructor and persist methods be identical.
name The name of the securable object with which this <see cref="T:System.Security.AccessControl.NativeObjectSecurity" /> object is associated.
includeSections One of the <see cref="T:System.Security.AccessControl.AccessControlSections" /> enumeration values that specifies the sections of the security descriptor (access rules, audit rules, owner, primary group) of the securable object to save.
exceptionContext An object that contains contextual information about the source or destination of the exception.
protected void
AddAccessRule​(AccessRule rule)
Inherited from CommonObjectSecurity
Adds the specified access rule to the Discretionary Access Control List (DACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
rule The access rule to add.
protected void
AddAuditRule​(AuditRule rule)
Inherited from CommonObjectSecurity
Adds the specified audit rule to the System Access Control List (SACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
rule The audit rule to add.
GetAccessRules​(bool includeExplicit, bool includeInherited, Type targetType)
Inherited from CommonObjectSecurity
Gets a collection of the access rules associated with the specified security identifier.
Returns The collection of access rules associated with the specified <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
includeExplicit <see langword="true" /> to include access rules explicitly set for the object.
includeInherited <see langword="true" /> to include inherited access rules.
targetType Specifies whether the security identifier for which to retrieve access rules is of type <see cref="T:System.Security.Principal.SecurityIdentifier" /> or type <see cref="T:System.Security.Principal.NTAccount" /> . The value of this parameter must be a type that can be translated to the <see cref="T:System.Security.Principal.SecurityIdentifier" /> type.
GetAuditRules​(bool includeExplicit, bool includeInherited, Type targetType)
Inherited from CommonObjectSecurity
Gets a collection of the audit rules associated with the specified security identifier.
Returns The collection of audit rules associated with the specified <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
includeExplicit <see langword="true" /> to include audit rules explicitly set for the object.
includeInherited <see langword="true" /> to include inherited audit rules.
targetType The security identifier for which to retrieve audit rules. This must be an object that can be cast as a <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
protected bool
ModifyAccess​(AccessControlModification modification, AccessRule rule, Boolean& modified)
Inherited from CommonObjectSecurity
protected bool
ModifyAudit​(AccessControlModification modification, AuditRule rule, Boolean& modified)
Inherited from CommonObjectSecurity
protected bool
RemoveAccessRule​(AccessRule rule)
Inherited from CommonObjectSecurity
Removes access rules that contain the same security identifier and access mask as the specified access rule from the Discretionary Access Control List (DACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
Returns <see langword="true" /> if the access rule was successfully removed; otherwise, <see langword="false" /> .
rule The access rule to remove.
protected void
RemoveAccessRuleAll​(AccessRule rule)
Inherited from CommonObjectSecurity
Removes all access rules that have the same security identifier as the specified access rule from the Discretionary Access Control List (DACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
rule The access rule to remove.
protected void
RemoveAccessRuleSpecific​(AccessRule rule)
Inherited from CommonObjectSecurity
Removes all access rules that exactly match the specified access rule from the Discretionary Access Control List (DACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
rule The access rule to remove.
protected bool
RemoveAuditRule​(AuditRule rule)
Inherited from CommonObjectSecurity
Removes audit rules that contain the same security identifier and access mask as the specified audit rule from the System Access Control List (SACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
Returns <see langword="true" /> if the audit rule was successfully removed; otherwise, <see langword="false" /> .
rule The audit rule to remove.
protected void
RemoveAuditRuleAll​(AuditRule rule)
Inherited from CommonObjectSecurity
Removes all audit rules that have the same security identifier as the specified audit rule from the System Access Control List (SACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
rule The audit rule to remove.
protected void
RemoveAuditRuleSpecific​(AuditRule rule)
Inherited from CommonObjectSecurity
Removes all audit rules that exactly match the specified audit rule from the System Access Control List (SACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object.
rule The audit rule to remove.
protected void
ResetAccessRule​(AccessRule rule)
Inherited from CommonObjectSecurity
Removes all access rules in the Discretionary Access Control List (DACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object and then adds the specified access rule.
rule The access rule to reset.
protected void
SetAccessRule​(AccessRule rule)
Inherited from CommonObjectSecurity
Removes all access rules that contain the same security identifier and qualifier as the specified access rule in the Discretionary Access Control List (DACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object and then adds the specified access rule.
rule The access rule to set.
protected void
SetAuditRule​(AuditRule rule)
Inherited from CommonObjectSecurity
Removes all audit rules that contain the same security identifier and qualifier as the specified audit rule in the System Access Control List (SACL) associated with this <see cref="T:System.Security.AccessControl.CommonObjectSecurity" /> object and then adds the specified audit rule.
rule The audit rule to set.
public AccessRule
AccessRuleFactory​(Principal.​IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
Inherited from ObjectSecurity
Initializes a new instance of the <see cref="T:System.Security.AccessControl.AccessRule" /> class with the specified values.
Returns The <see cref="T:System.Security.AccessControl.AccessRule" /> object that this method creates.
identityReference The identity to which the access rule applies. It must be an object that can be cast as a <see cref="T:System.Security.Principal.SecurityIdentifier" /> .
accessMask The access mask of this rule. The access mask is a 32-bit collection of anonymous bits, the meaning of which is defined by the individual integrators.
isInherited true if this rule is inherited from a parent container.
inheritanceFlags Specifies the inheritance properties of the access rule.
propagationFlags Specifies whether inherited access rules are automatically propagated. The propagation flags are ignored if <paramref name="inheritanceFlags" /> is set to <see cref="F:System.Security.AccessControl.InheritanceFlags.None" /> .
type Specifies the valid access control type.
public AuditRule
AuditRuleFactory​(Principal.​IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
Inherited from ObjectSecurity
Initializes a new instance of the <see cref="T:System.Security.AccessControl.AuditRule" /> class with the specified values.
Returns The <see cref="T:System.Security.AccessControl.AuditRule" /> object that this method creates.
identityReference The identity to which the audit rule applies. It must be an object that can be cast as a <see cref="T:System.Security.Principal.SecurityIdentifier" /> .
accessMask The access mask of this rule. The access mask is a 32-bit collection of anonymous bits, the meaning of which is defined by the individual integrators.
isInherited <see langword="true" /> if this rule is inherited from a parent container.
inheritanceFlags Specifies the inheritance properties of the audit rule.
propagationFlags Specifies whether inherited audit rules are automatically propagated. The propagation flags are ignored if <paramref name="inheritanceFlags" /> is set to <see cref="F:System.Security.AccessControl.InheritanceFlags.None" /> .
flags Specifies the conditions for which the rule is audited.
GetGroup​(Type targetType)
Inherited from ObjectSecurity
Gets the primary group associated with the specified owner.
Returns The primary group associated with the specified owner.
targetType The owner for which to get the primary group.
GetOwner​(Type targetType)
Inherited from ObjectSecurity
Gets the owner associated with the specified primary group.
Returns The owner associated with the specified group.
targetType The primary group for which to get the owner.
public byte[]
GetSecurityDescriptorBinaryForm​()
Inherited from ObjectSecurity
Returns an array of byte values that represents the security descriptor information for this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object.
Returns An array of byte values that represents the security descriptor for this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object. This method returns <see langword="null" /> if there is no security information in this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object.
public string
GetSecurityDescriptorSddlForm​(AccessControlSections includeSections)
Inherited from ObjectSecurity
Returns the Security Descriptor Definition Language (SDDL) representation of the specified sections of the security descriptor associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object.
Returns The SDDL representation of the specified sections of the security descriptor associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object.
includeSections Specifies which sections (access rules, audit rules, primary group, owner) of the security descriptor to get.
public bool
ModifyAccessRule​(AccessControlModification modification, AccessRule rule, Boolean& modified)
Inherited from ObjectSecurity
public bool
ModifyAuditRule​(AccessControlModification modification, AuditRule rule, Boolean& modified)
Inherited from ObjectSecurity
protected void
Persist​(bool enableOwnershipPrivilege, string name, AccessControlSections includeSections)
Inherited from ObjectSecurity
Saves the specified sections of the security descriptor associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object to permanent storage. We recommend that the values of the <paramref name="includeSections" /> parameters passed to the constructor and persist methods be identical.
enableOwnershipPrivilege <see langword="true" /> to enable the privilege that allows the caller to take ownership of the object.
name The name used to retrieve the persisted information.
includeSections One of the <see cref="T:System.Security.AccessControl.AccessControlSections" /> enumeration values that specifies the sections of the security descriptor (access rules, audit rules, owner, primary group) of the securable object to save.
public void
PurgeAccessRules​(Principal.​IdentityReference identity)
Inherited from ObjectSecurity
Removes all access rules associated with the specified <see cref="T:System.Security.Principal.IdentityReference" /> .
identity The <see cref="T:System.Security.Principal.IdentityReference" /> for which to remove all access rules.
public void
PurgeAuditRules​(Principal.​IdentityReference identity)
Inherited from ObjectSecurity
Removes all audit rules associated with the specified <see cref="T:System.Security.Principal.IdentityReference" /> .
identity The <see cref="T:System.Security.Principal.IdentityReference" /> for which to remove all audit rules.
protected void
ReadLock​()
Inherited from ObjectSecurity
Locks this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object for read access.
protected void
ReadUnlock​()
Inherited from ObjectSecurity
Unlocks this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object for read access.
public void
SetAccessRuleProtection​(bool isProtected, bool preserveInheritance)
Inherited from ObjectSecurity
Sets or removes protection of the access rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object. Protected access rules cannot be modified by parent objects through inheritance.
isProtected <see langword="true" /> to protect the access rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object from inheritance; <see langword="false" /> to allow inheritance.
preserveInheritance <see langword="true" /> to preserve inherited access rules; <see langword="false" /> to remove inherited access rules. This parameter is ignored if <paramref name="isProtected" /> is <see langword="false" /> .
public void
SetAuditRuleProtection​(bool isProtected, bool preserveInheritance)
Inherited from ObjectSecurity
Sets or removes protection of the audit rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object. Protected audit rules cannot be modified by parent objects through inheritance.
isProtected <see langword="true" /> to protect the audit rules associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object from inheritance; <see langword="false" /> to allow inheritance.
preserveInheritance <see langword="true" /> to preserve inherited audit rules; <see langword="false" /> to remove inherited audit rules. This parameter is ignored if <paramref name="isProtected" /> is <see langword="false" /> .
public void
SetGroup​(Principal.​IdentityReference identity)
Inherited from ObjectSecurity
Sets the primary group for the security descriptor associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object.
identity The primary group to set.
public void
SetOwner​(Principal.​IdentityReference identity)
Inherited from ObjectSecurity
Sets the owner for the security descriptor associated with this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object.
identity The owner to set.
public void
SetSecurityDescriptorBinaryForm​(byte[] binaryForm)
Inherited from ObjectSecurity
Sets the security descriptor for this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object from the specified array of byte values.
binaryForm The array of bytes from which to set the security descriptor.
public void
SetSecurityDescriptorBinaryForm​(byte[] binaryForm, AccessControlSections includeSections)
Inherited from ObjectSecurity
Sets the specified sections of the security descriptor for this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object from the specified array of byte values.
binaryForm The array of bytes from which to set the security descriptor.
includeSections The sections (access rules, audit rules, owner, primary group) of the security descriptor to set.
public void
SetSecurityDescriptorSddlForm​(string sddlForm)
Inherited from ObjectSecurity
Sets the security descriptor for this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object from the specified Security Descriptor Definition Language (SDDL) string.
sddlForm The SDDL string from which to set the security descriptor.
public void
SetSecurityDescriptorSddlForm​(string sddlForm, AccessControlSections includeSections)
Inherited from ObjectSecurity
Sets the specified sections of the security descriptor for this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object from the specified Security Descriptor Definition Language (SDDL) string.
sddlForm The SDDL string from which to set the security descriptor.
includeSections The sections (access rules, audit rules, owner, primary group) of the security descriptor to set.
protected void
WriteLock​()
Inherited from ObjectSecurity
Locks this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object for write access.
protected void
WriteUnlock​()
Inherited from ObjectSecurity
Unlocks this <see cref="T:System.Security.AccessControl.ObjectSecurity" /> object for write access.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object