SemaphoreSecurity.AccessRuleFactory Method

Definition

Creates a new access control rule for the specified user, with the specified access rights, access control, and flags.

public:
 override System::Security::AccessControl::AccessRule ^ AccessRuleFactory(System::Security::Principal::IdentityReference ^ identityReference, int accessMask, bool isInherited, System::Security::AccessControl::InheritanceFlags inheritanceFlags, System::Security::AccessControl::PropagationFlags propagationFlags, System::Security::AccessControl::AccessControlType type);
public override System.Security.AccessControl.AccessRule AccessRuleFactory (System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type);
override this.AccessRuleFactory : System.Security.Principal.IdentityReference * int * bool * System.Security.AccessControl.InheritanceFlags * System.Security.AccessControl.PropagationFlags * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.AccessRule
Public Overrides Function AccessRuleFactory (identityReference As IdentityReference, accessMask As Integer, isInherited As Boolean, inheritanceFlags As InheritanceFlags, propagationFlags As PropagationFlags, type As AccessControlType) As AccessRule

Parameters

identityReference
IdentityReference

An IdentityReference that identifies the user or group the rule applies to.

accessMask
Int32

A bitwise combination of SemaphoreRights values specifying the access rights to allow or deny, cast to an integer.

isInherited
Boolean

Meaningless for named semaphores, because they have no hierarchy.

inheritanceFlags
InheritanceFlags

Meaningless for named semaphores, because they have no hierarchy.

propagationFlags
PropagationFlags

Meaningless for named semaphores, because they have no hierarchy.

type
AccessControlType

One of the AccessControlType values specifying whether the rights are allowed or denied.

Returns

A SemaphoreAccessRule object representing the specified rights for the specified user.

Exceptions

accessMask, inheritanceFlags, propagationFlags, or type specifies an invalid value.

identityReference is null.

-or-

accessMask is zero.

identityReference is neither of type SecurityIdentifier, nor of a type such as NTAccount that can be converted to type SecurityIdentifier.

Remarks

The recommended way to create access control rules is to use the constructors of the SemaphoreAccessRule class.

Note

Although inheritance and propagation flags are meaningless for named semaphores, it is still possible to specify them This is not recommended, because it needlessly complicates the maintenance of rules, for example by interfering with the combination of rules that would otherwise be compatible.

Applies to