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

定义

使用指定的访问权限、访问控制和标志初始化 FileSystemAccessRule 类的新实例,该实例表示指定用户的新的访问控制规则。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
Public Overrides NotOverridable Function AccessRuleFactory (identityReference As IdentityReference, accessMask As Integer, isInherited As Boolean, inheritanceFlags As InheritanceFlags, propagationFlags As PropagationFlags, type As AccessControlType) As AccessRule

参数

identityReference
IdentityReference

表示用户帐户的 IdentityReference 对象。An IdentityReference object that represents a user account.

accessMask
Int32

指定访问类型的整数。An integer that specifies an access type.

isInherited
Boolean

如果该访问规则是继承的,则为 true;否则为 falsetrue if the access rule is inherited; otherwise, false.

inheritanceFlags
InheritanceFlags

InheritanceFlags 值之一,指定如何将访问掩码传播到子对象。One of the InheritanceFlags values that specifies how to propagate access masks to child objects.

propagationFlags
PropagationFlags

PropagationFlags 值之一,指定如何将访问控制项 (ACE) 传播到子对象。One of the PropagationFlags values that specifies how to propagate Access Control Entries (ACEs) to child objects.

type
AccessControlType

AccessControlType 值之一,指定允许还是拒绝访问。One of the AccessControlType values that specifies whether access is allowed or denied.

返回

AccessRule

表示指定用户的新访问控制规则的新的 FileSystemAccessRule 对象,具有指定的访问权限、访问控制和标志。A new FileSystemAccessRule object that represents a new access control rule for the specified user, with the specified access rights, access control, and flags.

例外

accessMaskinheritanceFlagspropagationFlagstype 参数指定了无效值。The accessMask, inheritanceFlags, propagationFlags, or type parameters specify an invalid value.

identityReference 参数为 nullThe identityReference parameter is null.

- 或 --or- accessMask 参数为零。The accessMask parameter is zero.

identityReference 既不是 SecurityIdentifier 类型,也不是可转换为 NTAccount 类型的类型,如 SecurityIdentifierThe identityReference parameter is neither of type SecurityIdentifier, nor of a type such as NTAccount that can be converted to type SecurityIdentifier.

注解

创建访问控制规则的建议方法是使用类的构造函数 FileSystemAccessRuleThe recommended way to create access control rules is to use the constructors of the FileSystemAccessRule class.

方法的返回类型 AccessRuleFactory 是基类, AccessRule 但返回值可以安全地强制转换为派生类。The return type of the AccessRuleFactory method is the base class, AccessRule, but the return value can be cast safely to the derived class.

适用于