System.Security.AccessControl.RegistrySecurity.AccessRuleFactory Method

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

Syntax

public override AccessRule AccessRuleFactory (System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)

Parameters

identityReference
An System.Security.Principal.IdentityReference that identifies the user or group the rule applies to.
accessMask
A bitwise combination of System.Security.AccessControl.RegistryRights values specifying the access rights to allow or deny, cast to an integer.
isInherited
A Boolean value specifying whether the rule is inherited.
inheritanceFlags
A bitwise combination of System.Security.AccessControl.InheritanceFlags values specifying how the rule is inherited by subkeys.
propagationFlags
A bitwise combination of System.Security.AccessControl.PropagationFlags values that modify the way the rule is inherited by subkeys. Meaningless if the value of inheritanceFlags is InheritanceFlags.None.
type
One of the System.Security.AccessControl.AccessControlType values specifying whether the rights are allowed or denied.

Returns

A System.Security.AccessControl.RegistryAccessRule object representing the specified rights for the specified user.

Remarks

The recommended way to create access control rules is to use the constructors of the System.Security.AccessControl.RegistryAccessRule class.

Note:

Although you can specify the InheritanceFlags.ObjectInherit flag, there is no point in doing so. For the purposes of access control, the name/value pairs in a subkey are not separate objects. The access rights to name/value pairs are controlled by the rights of the subkey. Furthermore, since all subkeys are containers (that is, they can contain other subkeys), they are not affected by the InheritanceFlags.ObjectInherit flag. Finally, specifying the InheritanceFlags.ObjectInherit flag needlessly complicates the maintenance of rules, because it interferes with the normal combination of compatible rules.

Requirements

Namespace: System.Security.AccessControl
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0