DiscretionaryAcl.SetAccess Method

Definition

Sets the specified access control for the specified SecurityIdentifier object.

Overloads

Remarks

These methods remove all existing Access Control Entries (ACEs) that match both specified SecurityIdentifier object and the specified access qualifier (allow or deny).

SetAccess(AccessControlType, SecurityIdentifier, ObjectAccessRule)

Source:
ACL.cs

Sets the specified access control for the specified SecurityIdentifier object.

C#
public void SetAccess(System.Security.AccessControl.AccessControlType accessType, System.Security.Principal.SecurityIdentifier sid, System.Security.AccessControl.ObjectAccessRule rule);

Parameters

accessType
AccessControlType

The type of access control (allow or deny) to set.

sid
SecurityIdentifier

The SecurityIdentifier for which to set an ACE.

rule
ObjectAccessRule

The ObjectAccessRule for which to set access.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, 6 (package-provided), 6, 7 (package-provided), 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5

SetAccess(AccessControlType, SecurityIdentifier, Int32, InheritanceFlags, PropagationFlags)

Source:
ACL.cs

Sets the specified access control for the specified SecurityIdentifier object.

C#
public void SetAccess(System.Security.AccessControl.AccessControlType accessType, System.Security.Principal.SecurityIdentifier sid, int accessMask, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags);

Parameters

accessType
AccessControlType

The type of access control (allow or deny) to set.

sid
SecurityIdentifier

The SecurityIdentifier for which to set an ACE.

accessMask
Int32

The access rule for the new ACE.

inheritanceFlags
InheritanceFlags

Flags that specify the inheritance properties of the new ACE.

propagationFlags
PropagationFlags

Flags that specify the inheritance propagation properties for the new ACE.

Remarks

This method removes all existing Access Control Entries (ACEs) that match both specified SecurityIdentifier object and the specified access qualifier (allow or deny).

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, 6 (package-provided), 6, 7 (package-provided), 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5

SetAccess(AccessControlType, SecurityIdentifier, Int32, InheritanceFlags, PropagationFlags, ObjectAceFlags, Guid, Guid)

Source:
ACL.cs

Sets the specified access control for the specified SecurityIdentifier object.

C#
public void SetAccess(System.Security.AccessControl.AccessControlType accessType, System.Security.Principal.SecurityIdentifier sid, int accessMask, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.ObjectAceFlags objectFlags, Guid objectType, Guid inheritedObjectType);

Parameters

accessType
AccessControlType

The type of access control (allow or deny) to set.

sid
SecurityIdentifier

The SecurityIdentifier for which to set an ACE.

accessMask
Int32

The access rule for the new ACE.

inheritanceFlags
InheritanceFlags

Flags that specify the inheritance properties of the new ACE.

propagationFlags
PropagationFlags

Flags that specify the inheritance propagation properties for the new ACE.

objectFlags
ObjectAceFlags

Flags that specify if the objectType and inheritedObjectType parameters contain non-null values.

objectType
Guid

The identity of the class of objects to which the new ACE applies.

inheritedObjectType
Guid

The identity of the class of child objects which can inherit the new ACE.

Remarks

This method removes all existing Access Control Entries (ACEs) that match both specified SecurityIdentifier object and the specified access qualifier (allow or deny).

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, 6 (package-provided), 6, 7 (package-provided), 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5