FileSystemSecurity::AccessRuleFactory Method (IdentityReference^, Int32, Boolean, InheritanceFlags, PropagationFlags, AccessControlType)
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.
Assembly: mscorlib (in mscorlib.dll)
public: virtual AccessRule^ AccessRuleFactory( IdentityReference^ identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type ) override sealed
Parameters
- identityReference
-
Type:
System.Security.Principal::IdentityReference^
An IdentityReference object that represents a user account.
- accessMask
-
Type:
System::Int32
An integer that specifies an access type.
- isInherited
-
Type:
System::Boolean
true if the access rule is inherited; otherwise, false.
- inheritanceFlags
-
Type:
System.Security.AccessControl::InheritanceFlags
One of the InheritanceFlags values that specifies how to propagate access masks to child objects.
- propagationFlags
-
Type:
System.Security.AccessControl::PropagationFlags
One of the PropagationFlags values that specifies how to propagate Access Control Entries (ACEs) to child objects.
- type
-
Type:
System.Security.AccessControl::AccessControlType
One of the AccessControlType values that specifies whether access is allowed or denied.
Return Value
Type: System.Security.AccessControl::AccessRule^A new FileSystemAccessRule object that represents a new access control rule for the specified user, with the specified access rights, access control, and flags.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The accessMask, inheritanceFlags, propagationFlags, or type parameters specify an invalid value. |
| ArgumentNullException | The identityReference parameter is null. -or- The accessMask parameter is zero. |
| ArgumentException | The identityReference parameter is neither of type SecurityIdentifier, nor of a type such as NTAccount that can be converted to type SecurityIdentifier. |
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.
Available since 2.0