FileSystemSecurity.AccessRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AccessControlType) Method

Definition

Initializes a new instance of the FileSystemAccessRule class that represents 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 sealed 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

Parameters

identityReference
IdentityReference

An IdentityReference object that represents a user account.

accessMask
Int32

An integer that specifies an access type.

isInherited
Boolean

true if the access rule is inherited; otherwise, false.

inheritanceFlags
InheritanceFlags

One of the InheritanceFlags values that specifies how to propagate access masks to child objects.

propagationFlags
PropagationFlags

One of the PropagationFlags values that specifies how to propagate Access Control Entries (ACEs) to child objects.

type
AccessControlType

One of the AccessControlType values that specifies whether access is allowed or denied.

Returns

A new FileSystemAccessRule object that represents a new access control rule for the specified user, with the specified access rights, access control, and flags.

Exceptions

The accessMask, inheritanceFlags, propagationFlags, or type parameters specify an invalid value.

The identityReference parameter is null.

-or-

The accessMask parameter is zero.

The identityReference parameter 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 FileSystemAccessRule class.

The return type of the AccessRuleFactory method is the base class, AccessRule, but the return value can be cast safely to the derived class.

Applies to