Прочетете на английски Редактиране

Споделяне чрез


RegistrySecurity.AuditRuleFactory Method

Definition

Creates a new audit rule, specifying the user the rule applies to, the access rights to audit, the inheritance and propagation of the rule, and the outcome that triggers the rule.

public override System.Security.AccessControl.AuditRule AuditRuleFactory (System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags);

Parameters

identityReference
IdentityReference

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

accessMask
Int32

A bitwise combination of RegistryRights values specifying the access rights to audit, cast to an integer.

isInherited
Boolean

A Boolean value specifying whether the rule is inherited.

inheritanceFlags
InheritanceFlags

A bitwise combination of InheritanceFlags values specifying how the rule is inherited by subkeys.

propagationFlags
PropagationFlags

A bitwise combination of PropagationFlags values that modify the way the rule is inherited by subkeys. Meaningless if the value of inheritanceFlags is None.

flags
AuditFlags

A bitwise combination of AuditFlags values specifying whether to audit successful access, failed access, or both.

Returns

A RegistryAuditRule object representing the specified audit rule for the specified user, with the specified flags. The return type of the method is the base class, AuditRule, but the return value can be cast safely to the derived class.

Exceptions

accessMask, inheritanceFlags, propagationFlags, or flags 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 audit rules is to use the constructors of the RegistryAuditRule class.

Бележка

Although you can specify the InheritanceFlags.ObjectInherit flag, there is no point in doing so. For the purposes of audit control, the name/value pairs in a subkey are not separate objects. The audit 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 ObjectInherit flag. Finally, specifying the ObjectInherit flag needlessly complicates the maintenance of rules, because it interferes with the normal combination of compatible rules.

Applies to

Продукт Версии
.NET Core 1.0, Core 1.1, 6, 7, 8, 9
.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