FileSecurity FileSecurity FileSecurity FileSecurity Class

定义

表示文件的访问控制和审核安全。Represents the access control and audit security for a file. 此类不能被继承。This class cannot be inherited.

public ref class FileSecurity sealed : System::Security::AccessControl::FileSystemSecurity
[System.Security.SecurityCritical]
public sealed class FileSecurity : System.Security.AccessControl.FileSystemSecurity
type FileSecurity = class
    inherit FileSystemSecurity
Public NotInheritable Class FileSecurity
Inherits FileSystemSecurity
继承
属性

示例

下面的代码示例使用FileSecurity类来添加,然后从文件删除访问控制列表 (ACL) 项。The following code example uses the FileSecurity class to add and then remove an access control list (ACL) entry from a file. 你必须提供有效的用户或组帐户以运行此示例。You must supply a valid user or group account to run this example.

using namespace System;
using namespace System::IO;
using namespace System::Security::AccessControl;

// Adds an ACL entry on the specified file for the specified account.

void AddFileSecurity(String^ fileName, String^ account, 
                        FileSystemRights rights, AccessControlType controlType)
{
    // Get a FileSecurity object that represents the 
    // current security settings.
    FileSecurity^ fSecurity = File::GetAccessControl(fileName);

    // Add the FileSystemAccessRule to the security settings. 
    fSecurity->AddAccessRule(gcnew FileSystemAccessRule
                                   (account,rights, controlType));

    // Set the new access settings.
    File::SetAccessControl(fileName, fSecurity);
}

// Removes an ACL entry on the specified file for the specified account.

void RemoveFileSecurity(String^ fileName, String^ account, 
                        FileSystemRights rights, AccessControlType controlType)
{

    // Get a FileSecurity object that represents the 
    // current security settings.
    FileSecurity^ fSecurity = File::GetAccessControl(fileName);

    // Remove the FileSystemAccessRule from the security settings. 
    fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule
                                      (account,rights, controlType));

    // Set the new access settings.
    File::SetAccessControl(fileName, fSecurity);
}

int main()
{
    try
    {
        String^ fileName = "test.xml";

        Console::WriteLine("Adding access control entry for " + fileName);

        // Add the access control entry to the file.
        AddFileSecurity(fileName, "MYDOMAIN\\MyAccount", 
            FileSystemRights::ReadData, AccessControlType::Allow);

        Console::WriteLine("Removing access control entry from " + fileName);

        // Remove the access control entry from the file.
        RemoveFileSecurity(fileName, "MYDOMAIN\\MyAccount", 
            FileSystemRights::ReadData, AccessControlType::Allow);

        Console::WriteLine("Done.");
    }
    catch (Exception^ ex)
    {
        Console::WriteLine(ex->Message);
    }
}

using System;
using System.IO;
using System.Security.AccessControl;

namespace FileSystemExample
{
    class FileExample
    {
        public static void Main()
        {
            try
            {
                string fileName = "test.xml";

                Console.WriteLine("Adding access control entry for "
                    + fileName);

                // Add the access control entry to the file.
                AddFileSecurity(fileName, @"DomainName\AccountName",
                    FileSystemRights.ReadData, AccessControlType.Allow);

                Console.WriteLine("Removing access control entry from "
                    + fileName);

                // Remove the access control entry from the file.
                RemoveFileSecurity(fileName, @"DomainName\AccountName",
                    FileSystemRights.ReadData, AccessControlType.Allow);

                Console.WriteLine("Done.");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }

        // Adds an ACL entry on the specified file for the specified account.
        public static void AddFileSecurity(string fileName, string account,
            FileSystemRights rights, AccessControlType controlType)
        {


            // Get a FileSecurity object that represents the
            // current security settings.
            FileSecurity fSecurity = File.GetAccessControl(fileName);

            // Add the FileSystemAccessRule to the security settings.
            fSecurity.AddAccessRule(new FileSystemAccessRule(account,
                rights, controlType));

            // Set the new access settings.
            File.SetAccessControl(fileName, fSecurity);

        }

        // Removes an ACL entry on the specified file for the specified account.
        public static void RemoveFileSecurity(string fileName, string account,
            FileSystemRights rights, AccessControlType controlType)
        {

            // Get a FileSecurity object that represents the
            // current security settings.
            FileSecurity fSecurity = File.GetAccessControl(fileName);

            // Remove the FileSystemAccessRule from the security settings.
            fSecurity.RemoveAccessRule(new FileSystemAccessRule(account,
                rights, controlType));

            // Set the new access settings.
            File.SetAccessControl(fileName, fSecurity);

        }
    }
}
Imports System
Imports System.IO
Imports System.Security.AccessControl



Module FileExample

    Sub Main()
        Try
            Dim fileName As String = "test.xml"

            Console.WriteLine("Adding access control entry for " & fileName)

            ' Add the access control entry to the file.
            AddFileSecurity(fileName, "DomainName\AccountName", _
                FileSystemRights.ReadData, AccessControlType.Allow)

            Console.WriteLine("Removing access control entry from " & fileName)

            ' Remove the access control entry from the file.
            RemoveFileSecurity(fileName, "DomainName\AccountName", _
                FileSystemRights.ReadData, AccessControlType.Allow)

            Console.WriteLine("Done.")
        Catch e As Exception
            Console.WriteLine(e)
        End Try

    End Sub


    ' Adds an ACL entry on the specified file for the specified account.
    Sub AddFileSecurity(ByVal fileName As String, ByVal account As String, _
        ByVal rights As FileSystemRights, ByVal controlType As AccessControlType)
  
        ' Get a FileSecurity object that represents the 
        ' current security settings.
        Dim fSecurity As FileSecurity = File.GetAccessControl(fileName)

        ' Add the FileSystemAccessRule to the security settings. 
        Dim accessRule As FileSystemAccessRule = _
            New FileSystemAccessRule(account, rights, controlType)

        fSecurity.AddAccessRule(accessRule)

        ' Set the new access settings.
        File.SetAccessControl(fileName, fSecurity)

    End Sub


    ' Removes an ACL entry on the specified file for the specified account.
    Sub RemoveFileSecurity(ByVal fileName As String, ByVal account As String, _
        ByVal rights As FileSystemRights, ByVal controlType As AccessControlType)

        ' Get a FileSecurity object that represents the 
        ' current security settings.
        Dim fSecurity As FileSecurity = File.GetAccessControl(fileName)

        ' Remove the FileSystemAccessRule from the security settings. 
        fSecurity.RemoveAccessRule(New FileSystemAccessRule(account, _
            rights, controlType))

        ' Set the new access settings.
        File.SetAccessControl(fileName, fSecurity)

    End Sub
End Module

注解

FileSecurity类指定为系统文件以及如何审核访问尝试的访问权限。The FileSecurity class specifies the access rights for a system file and how access attempts are audited. 此类访问和审核权限表示为一组规则。This class represents access and audit rights as a set of rules. 表示每个访问规则FileSystemAccessRule对象,而表示每个审核规则FileSystemAuditRule对象。Each access rule is represented by a FileSystemAccessRule object, while each audit rule is represented by a FileSystemAuditRule object.

FileSecurity类是抽象的基础的 Microsoft Windows 文件安全系统。The FileSecurity class is an abstraction of the underlying Microsoft Windows file security system. 在此系统中,每个文件具有的任意访问控制列表 (DACL),它控制对文件的访问和系统访问控制列表 (SACL),指定要审核的访问控制尝试。In this system, each file has a discretionary access control list (DACL), which controls access to the file, and a system access control list (SACL), which specifies the access control attempts that are audited. FileSystemAccessRuleFileSystemAuditRule类是抽象的访问控制项 (Ace) 构成的 Dacl 和 Sacl。The FileSystemAccessRule and FileSystemAuditRule classes are abstractions of the access control entries (ACEs) that comprise DACLs and SACLs.

FileSecurity类隐藏许多 Dacl 和 Sacl 的详细信息; 无需担心 ACE 排序或 null DACL。The FileSecurity class hides many of the details of DACLs and SACLs; you do not have to worry about ACE ordering or null DACLS.

使用FileSecurity类来检索、 添加或更改表示 DACL 和 SACL 的文件的访问规则。Use the FileSecurity class to retrieve, add, or change the access rules that represent the DACL and SACL of a file.

若要将新的或已更改的访问或审核规则的文件,请使用SetAccessControl方法。To persist new or changed access or audit rules to a file, use the SetAccessControl method. 若要从现有文件检索访问或审核规则,请使用 GetAccessControl 方法。To retrieve access or audit rules from an existing file, use the GetAccessControl method.

构造函数

FileSecurity() FileSecurity() FileSecurity() FileSecurity()

初始化 FileSecurity 类的新实例。Initializes a new instance of the FileSecurity class.

FileSecurity(String, AccessControlSections) FileSecurity(String, AccessControlSections) FileSecurity(String, AccessControlSections) FileSecurity(String, AccessControlSections)

使用 FileSecurity 枚举的指定值从指定文件初始化 AccessControlSections 类的新实例。Initializes a new instance of the FileSecurity class from a specified file using the specified values of the AccessControlSections enumeration.

方法

AccessRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AccessControlType) AccessRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AccessControlType) AccessRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AccessControlType) 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.

(Inherited from FileSystemSecurity)
AddAccessRule(AccessRule) AddAccessRule(AccessRule) AddAccessRule(AccessRule) AddAccessRule(AccessRule)

将指定的访问规则添加到与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL)。Adds the specified access rule to the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
AddAccessRule(FileSystemAccessRule) AddAccessRule(FileSystemAccessRule) AddAccessRule(FileSystemAccessRule) AddAccessRule(FileSystemAccessRule)

将指定的访问控制列表 (ACL) 权限添加到当前文件或目录。Adds the specified access control list (ACL) permission to the current file or directory.

(Inherited from FileSystemSecurity)
AddAuditRule(AuditRule) AddAuditRule(AuditRule) AddAuditRule(AuditRule) AddAuditRule(AuditRule)

将指定的审核规则添加到与该 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL)。Adds the specified audit rule to the System Access Control List (SACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
AddAuditRule(FileSystemAuditRule) AddAuditRule(FileSystemAuditRule) AddAuditRule(FileSystemAuditRule) AddAuditRule(FileSystemAuditRule)

将指定的审核规则添加到当前文件或目录。Adds the specified audit rule to the current file or directory.

(Inherited from FileSystemSecurity)
AuditRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AuditFlags) AuditRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AuditFlags) AuditRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AuditFlags) AuditRuleFactory(IdentityReference, Int32, Boolean, InheritanceFlags, PropagationFlags, AuditFlags)

初始化 FileSystemAuditRule 类的新实例,它表示指定用户的指定审核规则。Initializes a new instance of the FileSystemAuditRule class representing the specified audit rule for the specified user.

(Inherited from FileSystemSecurity)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetAccessRules(Boolean, Boolean, Type) GetAccessRules(Boolean, Boolean, Type) GetAccessRules(Boolean, Boolean, Type) GetAccessRules(Boolean, Boolean, Type)

获取与指定的安全性标识符关联的访问规则的集合。Gets a collection of the access rules associated with the specified security identifier.

(Inherited from CommonObjectSecurity)
GetAuditRules(Boolean, Boolean, Type) GetAuditRules(Boolean, Boolean, Type) GetAuditRules(Boolean, Boolean, Type) GetAuditRules(Boolean, Boolean, Type)

获取与指定的安全性标识符关联的审核规则的集合。Gets a collection of the audit rules associated with the specified security identifier.

(Inherited from CommonObjectSecurity)
GetGroup(Type) GetGroup(Type) GetGroup(Type) GetGroup(Type)

获取与指定所有者关联的主要组。Gets the primary group associated with the specified owner.

(Inherited from ObjectSecurity)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetOwner(Type) GetOwner(Type) GetOwner(Type) GetOwner(Type)

获取与指定主要组关联的所有者。Gets the owner associated with the specified primary group.

(Inherited from ObjectSecurity)
GetSecurityDescriptorBinaryForm() GetSecurityDescriptorBinaryForm() GetSecurityDescriptorBinaryForm() GetSecurityDescriptorBinaryForm()

返回表示此 ObjectSecurity 对象的安全描述符信息的字节值数组。Returns an array of byte values that represents the security descriptor information for this ObjectSecurity object.

(Inherited from ObjectSecurity)
GetSecurityDescriptorSddlForm(AccessControlSections) GetSecurityDescriptorSddlForm(AccessControlSections) GetSecurityDescriptorSddlForm(AccessControlSections) GetSecurityDescriptorSddlForm(AccessControlSections)

返回与此 ObjectSecurity 对象关联的安全描述符的指定部分的安全描述符定义语言 (SDDL) 表示形式。Returns the Security Descriptor Definition Language (SDDL) representation of the specified sections of the security descriptor associated with this ObjectSecurity object.

(Inherited from ObjectSecurity)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ModifyAccess(AccessControlModification, AccessRule, Boolean) ModifyAccess(AccessControlModification, AccessRule, Boolean) ModifyAccess(AccessControlModification, AccessRule, Boolean) ModifyAccess(AccessControlModification, AccessRule, Boolean)

将指定的修改应用到与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中。Applies the specified modification to the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
ModifyAccessRule(AccessControlModification, AccessRule, Boolean) ModifyAccessRule(AccessControlModification, AccessRule, Boolean) ModifyAccessRule(AccessControlModification, AccessRule, Boolean) ModifyAccessRule(AccessControlModification, AccessRule, Boolean)

将指定的修改应用到与此 ObjectSecurity 对象关联的自由访问控制列表 (DACL) 中。Applies the specified modification to the Discretionary Access Control List (DACL) associated with this ObjectSecurity object.

(Inherited from ObjectSecurity)
ModifyAudit(AccessControlModification, AuditRule, Boolean) ModifyAudit(AccessControlModification, AuditRule, Boolean) ModifyAudit(AccessControlModification, AuditRule, Boolean) ModifyAudit(AccessControlModification, AuditRule, Boolean)

将指定的修改应用到与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中。Applies the specified modification to the System Access Control List (SACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
ModifyAuditRule(AccessControlModification, AuditRule, Boolean) ModifyAuditRule(AccessControlModification, AuditRule, Boolean) ModifyAuditRule(AccessControlModification, AuditRule, Boolean) ModifyAuditRule(AccessControlModification, AuditRule, Boolean)

将指定的修改应用到与此 ObjectSecurity 对象关联的系统访问控制列表 (SACL) 中。Applies the specified modification to the System Access Control List (SACL) associated with this ObjectSecurity object.

(Inherited from ObjectSecurity)
Persist(Boolean, String, AccessControlSections) Persist(Boolean, String, AccessControlSections) Persist(Boolean, String, AccessControlSections) Persist(Boolean, String, AccessControlSections)

将与此 ObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。Saves the specified sections of the security descriptor associated with this ObjectSecurity object to permanent storage. 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(Inherited from ObjectSecurity)
Persist(SafeHandle, AccessControlSections) Persist(SafeHandle, AccessControlSections) Persist(SafeHandle, AccessControlSections) Persist(SafeHandle, AccessControlSections)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 我们建议保持传递给构造函数和 persist 方法的 includeSections 参数的值完全相同。We recommend.persist that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(Inherited from NativeObjectSecurity)
Persist(SafeHandle, AccessControlSections, Object) Persist(SafeHandle, AccessControlSections, Object) Persist(SafeHandle, AccessControlSections, Object) Persist(SafeHandle, AccessControlSections, Object)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(Inherited from NativeObjectSecurity)
Persist(String, AccessControlSections) Persist(String, AccessControlSections) Persist(String, AccessControlSections) Persist(String, AccessControlSections)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(Inherited from NativeObjectSecurity)
Persist(String, AccessControlSections, Object) Persist(String, AccessControlSections, Object) Persist(String, AccessControlSections, Object) Persist(String, AccessControlSections, Object)

将与此 NativeObjectSecurity 对象关联的安全描述符的指定部分保存到永久存储中。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 我们建议传递给构造函数和 persist 方法的 includeSections 参数的值应完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(Inherited from NativeObjectSecurity)
PurgeAccessRules(IdentityReference) PurgeAccessRules(IdentityReference) PurgeAccessRules(IdentityReference) PurgeAccessRules(IdentityReference)

删除与指定 IdentityReference 关联的所有访问规则。Removes all access rules associated with the specified IdentityReference.

(Inherited from ObjectSecurity)
PurgeAuditRules(IdentityReference) PurgeAuditRules(IdentityReference) PurgeAuditRules(IdentityReference) PurgeAuditRules(IdentityReference)

删除与指定 IdentityReference 关联的所有审核规则。Removes all audit rules associated with the specified IdentityReference.

(Inherited from ObjectSecurity)
ReadLock() ReadLock() ReadLock() ReadLock()

为读取访问锁定此 ObjectSecurity 对象。Locks this ObjectSecurity object for read access.

(Inherited from ObjectSecurity)
ReadUnlock() ReadUnlock() ReadUnlock() ReadUnlock()

解锁此 ObjectSecurity 对象以进行读取访问。Unlocks this ObjectSecurity object for read access.

(Inherited from ObjectSecurity)
RemoveAccessRule(AccessRule) RemoveAccessRule(AccessRule) RemoveAccessRule(AccessRule) RemoveAccessRule(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则具有相同安全性标识符和访问掩码的访问规则。Removes access rules that contain the same security identifier and access mask as the specified access rule from the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
RemoveAccessRule(FileSystemAccessRule) RemoveAccessRule(FileSystemAccessRule) RemoveAccessRule(FileSystemAccessRule) RemoveAccessRule(FileSystemAccessRule)

从当前文件或目录移除所有匹配的允许或拒绝访问控制列表 (ACL) 权限。Removes all matching allow or deny access control list (ACL) permissions from the current file or directory.

(Inherited from FileSystemSecurity)
RemoveAccessRuleAll(AccessRule) RemoveAccessRuleAll(AccessRule) RemoveAccessRuleAll(AccessRule) RemoveAccessRuleAll(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则具有相同安全性标识符的所有访问规则。Removes all access rules that have the same security identifier as the specified access rule from the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
RemoveAccessRuleAll(FileSystemAccessRule) RemoveAccessRuleAll(FileSystemAccessRule) RemoveAccessRuleAll(FileSystemAccessRule) RemoveAccessRuleAll(FileSystemAccessRule)

从当前文件或目录移除指定用户的所有访问控制列表 (ACL) 权限。Removes all access control list (ACL) permissions for the specified user from the current file or directory.

(Inherited from FileSystemSecurity)
RemoveAccessRuleSpecific(AccessRule) RemoveAccessRuleSpecific(AccessRule) RemoveAccessRuleSpecific(AccessRule) RemoveAccessRuleSpecific(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则完全匹配的所有访问规则。Removes all access rules that exactly match the specified access rule from the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
RemoveAccessRuleSpecific(FileSystemAccessRule) RemoveAccessRuleSpecific(FileSystemAccessRule) RemoveAccessRuleSpecific(FileSystemAccessRule) RemoveAccessRuleSpecific(FileSystemAccessRule)

从当前文件或目录移除单个匹配的允许或拒绝访问控制列表 (ACL) 权限。Removes a single matching allow or deny access control list (ACL) permission from the current file or directory.

(Inherited from FileSystemSecurity)
RemoveAuditRule(AuditRule) RemoveAuditRule(AuditRule) RemoveAuditRule(AuditRule) RemoveAuditRule(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则具有相同安全性标识符和访问掩码的审核规则。Removes audit rules that contain the same security identifier and access mask as the specified audit rule from the System Access Control List (SACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
RemoveAuditRule(FileSystemAuditRule) RemoveAuditRule(FileSystemAuditRule) RemoveAuditRule(FileSystemAuditRule) RemoveAuditRule(FileSystemAuditRule)

从当前文件或目录移除所有匹配的允许或拒绝审核规则。Removes all matching allow or deny audit rules from the current file or directory.

(Inherited from FileSystemSecurity)
RemoveAuditRuleAll(AuditRule) RemoveAuditRuleAll(AuditRule) RemoveAuditRuleAll(AuditRule) RemoveAuditRuleAll(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则具有相同安全性标识符的所有审核规则。Removes all audit rules that have the same security identifier as the specified audit rule from the System Access Control List (SACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
RemoveAuditRuleAll(FileSystemAuditRule) RemoveAuditRuleAll(FileSystemAuditRule) RemoveAuditRuleAll(FileSystemAuditRule) RemoveAuditRuleAll(FileSystemAuditRule)

从当前文件或目录移除指定用户的所有审核规则。Removes all audit rules for the specified user from the current file or directory.

(Inherited from FileSystemSecurity)
RemoveAuditRuleSpecific(AuditRule) RemoveAuditRuleSpecific(AuditRule) RemoveAuditRuleSpecific(AuditRule) RemoveAuditRuleSpecific(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则完全匹配的所有审核规则。Removes all audit rules that exactly match the specified audit rule from the System Access Control List (SACL) associated with this CommonObjectSecurity object.

(Inherited from CommonObjectSecurity)
RemoveAuditRuleSpecific(FileSystemAuditRule) RemoveAuditRuleSpecific(FileSystemAuditRule) RemoveAuditRuleSpecific(FileSystemAuditRule) RemoveAuditRuleSpecific(FileSystemAuditRule)

从当前文件或目录移除单个匹配的允许或拒绝审核规则。Removes a single matching allow or deny audit rule from the current file or directory.

(Inherited from FileSystemSecurity)
ResetAccessRule(AccessRule) ResetAccessRule(AccessRule) ResetAccessRule(AccessRule) ResetAccessRule(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除所有访问规则,然后添加指定的访问规则。Removes all access rules in the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object and then adds the specified access rule.

(Inherited from CommonObjectSecurity)
ResetAccessRule(FileSystemAccessRule) ResetAccessRule(FileSystemAccessRule) ResetAccessRule(FileSystemAccessRule) ResetAccessRule(FileSystemAccessRule)

将指定的访问控制列表 (ACL) 权限添加到当前文件或目录,并移除所有匹配的 ACL 权限。Adds the specified access control list (ACL) permission to the current file or directory and removes all matching ACL permissions.

(Inherited from FileSystemSecurity)
SetAccessRule(AccessRule) SetAccessRule(AccessRule) SetAccessRule(AccessRule) SetAccessRule(AccessRule)

从与此 CommonObjectSecurity 对象关联的自由访问控制列表 (DACL) 中移除与指定的访问规则具有相同安全性标识符和限定符的所有访问规则,然后添加指定的访问规则。Removes all access rules that contain the same security identifier and qualifier as the specified access rule in the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object and then adds the specified access rule.

(Inherited from CommonObjectSecurity)
SetAccessRule(FileSystemAccessRule) SetAccessRule(FileSystemAccessRule) SetAccessRule(FileSystemAccessRule) SetAccessRule(FileSystemAccessRule)

设置当前文件或目录的指定访问控制列表 (ACL) 权限。Sets the specified access control list (ACL) permission for the current file or directory.

(Inherited from FileSystemSecurity)
SetAccessRuleProtection(Boolean, Boolean) SetAccessRuleProtection(Boolean, Boolean) SetAccessRuleProtection(Boolean, Boolean) SetAccessRuleProtection(Boolean, Boolean)

设置或删除与此 ObjectSecurity 对象相关联的访问规则保护。Sets or removes protection of the access rules associated with this ObjectSecurity object. 父级对象不能通过继承来修改受保护的访问规则。Protected access rules cannot be modified by parent objects through inheritance.

(Inherited from ObjectSecurity)
SetAuditRule(AuditRule) SetAuditRule(AuditRule) SetAuditRule(AuditRule) SetAuditRule(AuditRule)

从与此 CommonObjectSecurity 对象关联的系统访问控制列表 (SACL) 中移除与指定的审核规则具有相同的安全性标识符和限定符所有审核规则,然后添加指定的审核规则。Removes all audit rules that contain the same security identifier and qualifier as the specified audit rule in the System Access Control List (SACL) associated with this CommonObjectSecurity object and then adds the specified audit rule.

(Inherited from CommonObjectSecurity)
SetAuditRule(FileSystemAuditRule) SetAuditRule(FileSystemAuditRule) SetAuditRule(FileSystemAuditRule) SetAuditRule(FileSystemAuditRule)

设置当前文件或目录的指定审核规则。Sets the specified audit rule for the current file or directory.

(Inherited from FileSystemSecurity)
SetAuditRuleProtection(Boolean, Boolean) SetAuditRuleProtection(Boolean, Boolean) SetAuditRuleProtection(Boolean, Boolean) SetAuditRuleProtection(Boolean, Boolean)

设置或删除与此 ObjectSecurity 对象相关联的审核规则保护。Sets or removes protection of the audit rules associated with this ObjectSecurity object. 不能由通过继承的父级对象修改受保护的审核规则。Protected audit rules cannot be modified by parent objects through inheritance.

(Inherited from ObjectSecurity)
SetGroup(IdentityReference) SetGroup(IdentityReference) SetGroup(IdentityReference) SetGroup(IdentityReference)

设置与此 ObjectSecurity 对象关联的安全描述符的主要组。Sets the primary group for the security descriptor associated with this ObjectSecurity object.

(Inherited from ObjectSecurity)
SetOwner(IdentityReference) SetOwner(IdentityReference) SetOwner(IdentityReference) SetOwner(IdentityReference)

设置与此 ObjectSecurity 对象关联的安全描述符的所有者。Sets the owner for the security descriptor associated with this ObjectSecurity object.

(Inherited from ObjectSecurity)
SetSecurityDescriptorBinaryForm(Byte[]) SetSecurityDescriptorBinaryForm(Byte[]) SetSecurityDescriptorBinaryForm(Byte[]) SetSecurityDescriptorBinaryForm(Byte[])

根据指定的字节值数组设置此 ObjectSecurity 对象的安全描述符。Sets the security descriptor for this ObjectSecurity object from the specified array of byte values.

(Inherited from ObjectSecurity)
SetSecurityDescriptorBinaryForm(Byte[], AccessControlSections) SetSecurityDescriptorBinaryForm(Byte[], AccessControlSections) SetSecurityDescriptorBinaryForm(Byte[], AccessControlSections) SetSecurityDescriptorBinaryForm(Byte[], AccessControlSections)

根据指定的字节值数组设置此 ObjectSecurity 对象的安全描述符的指定部分。Sets the specified sections of the security descriptor for this ObjectSecurity object from the specified array of byte values.

(Inherited from ObjectSecurity)
SetSecurityDescriptorSddlForm(String) SetSecurityDescriptorSddlForm(String) SetSecurityDescriptorSddlForm(String) SetSecurityDescriptorSddlForm(String)

根据指定的安全描述符定义语言 (SDDL) 字符串设置此 ObjectSecurity 对象的安全描述符。Sets the security descriptor for this ObjectSecurity object from the specified Security Descriptor Definition Language (SDDL) string.

(Inherited from ObjectSecurity)
SetSecurityDescriptorSddlForm(String, AccessControlSections) SetSecurityDescriptorSddlForm(String, AccessControlSections) SetSecurityDescriptorSddlForm(String, AccessControlSections) SetSecurityDescriptorSddlForm(String, AccessControlSections)

根据指定的安全描述符定义语言 (SDDL) 字符串设置此 ObjectSecurity 对象的安全描述符的指定部分。Sets the specified sections of the security descriptor for this ObjectSecurity object from the specified Security Descriptor Definition Language (SDDL) string.

(Inherited from ObjectSecurity)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
WriteLock() WriteLock() WriteLock() WriteLock()

锁定此 ObjectSecurity 对象以进行写访问。Locks this ObjectSecurity object for write access.

(Inherited from ObjectSecurity)
WriteUnlock() WriteUnlock() WriteUnlock() WriteUnlock()

解锁此 ObjectSecurity 对象以进行写入访问。Unlocks this ObjectSecurity object for write access.

(Inherited from ObjectSecurity)

属性

AccessRightType AccessRightType AccessRightType AccessRightType

获取 FileSystemSecurity 类用于表示访问规则的枚举。Gets the enumeration that the FileSystemSecurity class uses to represent access rights.

(Inherited from FileSystemSecurity)
AccessRulesModified AccessRulesModified AccessRulesModified AccessRulesModified

获取或设置一个布尔值,该值指定是否已修改与此 ObjectSecurity 对象关联的访问规则。Gets or sets a Boolean value that specifies whether the access rules associated with this ObjectSecurity object have been modified.

(Inherited from ObjectSecurity)
AccessRuleType AccessRuleType AccessRuleType AccessRuleType

获取 FileSystemSecurity 类用于表示访问规则的枚举。Gets the enumeration that the FileSystemSecurity class uses to represent access rules.

(Inherited from FileSystemSecurity)
AreAccessRulesCanonical AreAccessRulesCanonical AreAccessRulesCanonical AreAccessRulesCanonical

获取一个布尔值,该值指定与此 ObjectSecurity 对象关联的访问规则是否处于规范顺序。Gets a Boolean value that specifies whether the access rules associated with this ObjectSecurity object are in canonical order.

(Inherited from ObjectSecurity)
AreAccessRulesProtected AreAccessRulesProtected AreAccessRulesProtected AreAccessRulesProtected

获取一个布尔值,用于指定与 ObjectSecurity 对象关联的自定义访问控制列表 (DACL) 是否受到保护。Gets a Boolean value that specifies whether the Discretionary Access Control List (DACL) associated with this ObjectSecurity object is protected.

(Inherited from ObjectSecurity)
AreAuditRulesCanonical AreAuditRulesCanonical AreAuditRulesCanonical AreAuditRulesCanonical

获取一个布尔值,该值指定与此 ObjectSecurity 对象关联的审核规则是否处于规范顺序。Gets a Boolean value that specifies whether the audit rules associated with this ObjectSecurity object are in canonical order.

(Inherited from ObjectSecurity)
AreAuditRulesProtected AreAuditRulesProtected AreAuditRulesProtected AreAuditRulesProtected

获取一个布尔值,该值指定与此 ObjectSecurity 对象关联的系统访问控制列表 (SACL) 是否受保护。Gets a Boolean value that specifies whether the System Access Control List (SACL) associated with this ObjectSecurity object is protected.

(Inherited from ObjectSecurity)
AuditRulesModified AuditRulesModified AuditRulesModified AuditRulesModified

获取或设置一个布尔值,该值指定是否已修改与此 ObjectSecurity 对象关联的审核规则。Gets or sets a Boolean value that specifies whether the audit rules associated with this ObjectSecurity object have been modified.

(Inherited from ObjectSecurity)
AuditRuleType AuditRuleType AuditRuleType AuditRuleType

获取 FileSystemSecurity 类用于表示审核规则的类型。Gets the type that the FileSystemSecurity class uses to represent audit rules.

(Inherited from FileSystemSecurity)
GroupModified GroupModified GroupModified GroupModified

获取或设置一个布尔值,该值指定是否已修改与安全对象相关联的组。Gets or sets a Boolean value that specifies whether the group associated with the securable object has been modified.

(Inherited from ObjectSecurity)
IsContainer IsContainer IsContainer IsContainer

获取一个指定此 ObjectSecurity 对象是否是容器对象的布尔值。Gets a Boolean value that specifies whether this ObjectSecurity object is a container object.

(Inherited from ObjectSecurity)
IsDS IsDS IsDS IsDS

获取一个布尔值,该值指定此 ObjectSecurity 对象是否是目录对象。Gets a Boolean value that specifies whether this ObjectSecurity object is a directory object.

(Inherited from ObjectSecurity)
OwnerModified OwnerModified OwnerModified OwnerModified

获取或设置一个布尔值,该值指定是否已修改安全对象的所有者。Gets or sets a Boolean value that specifies whether the owner of the securable object has been modified.

(Inherited from ObjectSecurity)

适用于