DirectorySecurity 類別

定義

表示目錄的存取控制和稽核安全性。Represents the access control and audit security for a directory. 這個類別無法被繼承。This class cannot be inherited.

public ref class DirectorySecurity sealed : System::Security::AccessControl::FileSystemSecurity
[System.Security.SecurityCritical]
public sealed class DirectorySecurity : System.Security.AccessControl.FileSystemSecurity
type DirectorySecurity = class
    inherit FileSystemSecurity
Public NotInheritable Class DirectorySecurity
Inherits FileSystemSecurity
繼承
屬性

範例

下列程式碼範例會使用DirectorySecurity類別來新增和移除目錄中的存取控制清單 (ACL) 專案。The following code example uses the DirectorySecurity class to add and then remove an access control list (ACL) entry from a directory. 您必須提供有效的使用者或群組帳戶,才能執行這個範例。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 directory for the
// specified account.
void AddDirectorySecurity(String^ directoryName, String^ account, 
     FileSystemRights rights, AccessControlType controlType)
{
    // Create a new DirectoryInfo object.
    DirectoryInfo^ dInfo = gcnew DirectoryInfo(directoryName);

    // Get a DirectorySecurity object that represents the
    // current security settings.
    DirectorySecurity^ dSecurity = dInfo->GetAccessControl();

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

    // Set the new access settings.
    dInfo->SetAccessControl(dSecurity);
}

// Removes an ACL entry on the specified directory for the
// specified account.
void RemoveDirectorySecurity(String^ directoryName, String^ account,
     FileSystemRights rights, AccessControlType controlType)
{
    // Create a new DirectoryInfo object.
    DirectoryInfo^ dInfo = gcnew DirectoryInfo(directoryName);

    // Get a DirectorySecurity object that represents the
    // current security settings.
    DirectorySecurity^ dSecurity = dInfo->GetAccessControl();

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

    // Set the new access settings.
    dInfo->SetAccessControl(dSecurity);
}    

int main()
{
    String^ directoryName = "TestDirectory";
    String^ accountName = "MYDOMAIN\\MyAccount";
    if (!Directory::Exists(directoryName))
    {
        Console::WriteLine("The directory {0} could not be found.", 
            directoryName);
        return 0;
    }
    try
    {
        Console::WriteLine("Adding access control entry for {0}",
            directoryName);

        // Add the access control entry to the directory.
        AddDirectorySecurity(directoryName, accountName,
            FileSystemRights::ReadData, AccessControlType::Allow);

        Console::WriteLine("Removing access control entry from {0}",
            directoryName);

        // Remove the access control entry from the directory.
        RemoveDirectorySecurity(directoryName, accountName, 
            FileSystemRights::ReadData, AccessControlType::Allow);

        Console::WriteLine("Done.");
    }
    catch (UnauthorizedAccessException^)
    {
        Console::WriteLine("You are not authorised to carry" +
            " out this procedure.");
    }
    catch (System::Security::Principal::
        IdentityNotMappedException^)
    {
        Console::WriteLine("The account {0} could not be found.", accountName);
    }
}

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

namespace FileSystemExample
{
    class DirectoryExample
    {
        public static void Main()
        {
            try
            {
                string DirectoryName = "TestDirectory";

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

                // Add the access control entry to the directory.
                AddDirectorySecurity(DirectoryName, @"MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow);

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

                // Remove the access control entry from the directory.
                RemoveDirectorySecurity(DirectoryName, @"MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow);

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

            Console.ReadLine();
        }

        // Adds an ACL entry on the specified directory for the specified account.
        public static void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
        {
            // Create a new DirectoryInfo object.
            DirectoryInfo dInfo = new DirectoryInfo(FileName);

            // Get a DirectorySecurity object that represents the 
            // current security settings.
            DirectorySecurity dSecurity = dInfo.GetAccessControl();

            // Add the FileSystemAccessRule to the security settings. 
            dSecurity.AddAccessRule(new FileSystemAccessRule(Account,
                                                            Rights,
                                                            ControlType));

            // Set the new access settings.
            dInfo.SetAccessControl(dSecurity);

        }

        // Removes an ACL entry on the specified directory for the specified account.
        public static void RemoveDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
        {
            // Create a new DirectoryInfo object.
            DirectoryInfo dInfo = new DirectoryInfo(FileName);

            // Get a DirectorySecurity object that represents the 
            // current security settings.
            DirectorySecurity dSecurity = dInfo.GetAccessControl();

            // Add the FileSystemAccessRule to the security settings. 
            dSecurity.RemoveAccessRule(new FileSystemAccessRule(Account,
                                                            Rights,
                                                            ControlType));

            // Set the new access settings.
            dInfo.SetAccessControl(dSecurity);

        }
    }
}

Imports System.IO
Imports System.Security.AccessControl



Module DirectoryExample

    Sub Main()
        Try
            Dim DirectoryName As String = "TestDirectory"

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

            ' Add the access control entry to the directory.
            AddDirectorySecurity(DirectoryName, "MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow)

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

            ' Remove the access control entry from the directory.
            RemoveDirectorySecurity(DirectoryName, "MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow)

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

        Console.ReadLine()

    End Sub


    ' Adds an ACL entry on the specified directory for the specified account.
    Sub AddDirectorySecurity(ByVal FileName As String, ByVal Account As String, ByVal Rights As FileSystemRights, ByVal ControlType As AccessControlType)
        ' Create a new DirectoryInfoobject.
        Dim dInfo As New DirectoryInfo(FileName)

        ' Get a DirectorySecurity object that represents the 
        ' current security settings.
        Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()

        ' Add the FileSystemAccessRule to the security settings. 
        dSecurity.AddAccessRule(New FileSystemAccessRule(Account, Rights, ControlType))

        ' Set the new access settings.
        dInfo.SetAccessControl(dSecurity)

    End Sub


    ' Removes an ACL entry on the specified directory for the specified account.
    Sub RemoveDirectorySecurity(ByVal FileName As String, ByVal Account As String, ByVal Rights As FileSystemRights, ByVal ControlType As AccessControlType)
        ' Create a new DirectoryInfo object.
        Dim dInfo As New DirectoryInfo(FileName)

        ' Get a DirectorySecurity object that represents the 
        ' current security settings.
        Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()

        ' Add the FileSystemAccessRule to the security settings. 
        dSecurity.RemoveAccessRule(New FileSystemAccessRule(Account, Rights, ControlType))

        ' Set the new access settings.
        dInfo.SetAccessControl(dSecurity)

    End Sub
End Module

備註

DirectorySecurity類別會指定系統目錄的存取權限, 以及如何審核存取嘗試。The DirectorySecurity class specifies the access rights for a system directory and how access attempts are audited. 此類別代表存取權和 audit 許可權做為一組規則。This class represents access and audit rights as a set of rules. 每個存取規則都是由FileSystemAccessRule物件表示, 而每個 audit 規則都是FileSystemAuditRule以物件表示。Each access rule is represented by a FileSystemAccessRule object, while each audit rule is represented by a FileSystemAuditRule object.

DirectorySecurity類別是基礎 Windows 檔案安全性系統的抽象概念。The DirectorySecurity class is an abstraction of the underlying Windows file security system. 在此系統中, 每個目錄都有任意存取控制清單 (DACL), 可控制目錄的存取權, 而系統存取控制清單 (SACL) 則會指定所要審核的存取控制嘗試。In this system, each directory has a discretionary access control list (DACL), which controls access to the directory, and a system access control list (SACL), which specifies the access control attempts that are audited. FileSystemAccessRuleFileSystemAuditRule類別是組成 dacl 和 sacl 的存取控制專案 (ace) 的抽象概念。The FileSystemAccessRule and FileSystemAuditRule classes are abstractions of the access control entries (ACEs) that comprise DACLs and SACLs.

DirectorySecurity類別會隱藏許多 dacl 和 sacl 的詳細資料, 您不需要擔心 ACE 順序或 null dacl。The DirectorySecurity 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.

下表列出您可以用來存取及維護目錄安全性的方法。The following tables lists the methods you can use to access and maintain directory security.

工作Task 方法Methods
新增規則Add rules FileSystemSecurity.AddAccessRule

FileSystemSecurity.AddAuditRule
移除規則Remove rules FileSystemSecurity.RemoveAccessRule

FileSystemSecurity.RemoveAuditRule
取得目錄的存取控制Retrieve the access control to a directory Directory.GetAccessControl

DirectoryInfo.GetAccessControl
將存取控制保存至目錄Persist the access control to a directory Directory.SetAccessControl

DirectoryInfo.SetAccessControl

建構函式

DirectorySecurity()

初始化 DirectorySecurity 類別的新執行個體。Initializes a new instance of the DirectorySecurity class.

DirectorySecurity(String, AccessControlSections)

使用 DirectorySecurity 列舉型別 (Enumeration) 之指定的值,從指定的目錄初始化 AccessControlSections 類別的新執行個體。Initializes a new instance of the DirectorySecurity class from a specified directory using the specified values of the AccessControlSections enumeration.

屬性

AccessRightType

取得 FileSystemSecurity 類別用來表示存取權限的列舉型別 (Enumeration)。Gets the enumeration that the FileSystemSecurity class uses to represent access rights.

(繼承來源 FileSystemSecurity)
AccessRulesModified

取得或設定布林值,指定是否已修改與這個 ObjectSecurity 物件關聯的存取規則。Gets or sets a Boolean value that specifies whether the access rules associated with this ObjectSecurity object have been modified.

(繼承來源 ObjectSecurity)
AccessRuleType

取得 FileSystemSecurity 類別用來表示存取規則的列舉型別。Gets the enumeration that the FileSystemSecurity class uses to represent access rules.

(繼承來源 FileSystemSecurity)
AreAccessRulesCanonical

取得布林值,指定與這個 ObjectSecurity 物件相關聯的存取規則是否為標準順序。Gets a Boolean value that specifies whether the access rules associated with this ObjectSecurity object are in canonical order.

(繼承來源 ObjectSecurity)
AreAccessRulesProtected

取得布林值,指定是否保護與這個 ObjectSecurity 物件相關聯的判別存取控制清單 (DACL)。Gets a Boolean value that specifies whether the Discretionary Access Control List (DACL) associated with this ObjectSecurity object is protected.

(繼承來源 ObjectSecurity)
AreAuditRulesCanonical

取得布林值,指定與 ObjectSecurity 物件相關聯的稽核規則是否為標準順序。Gets a Boolean value that specifies whether the audit rules associated with this ObjectSecurity object are in canonical order.

(繼承來源 ObjectSecurity)
AreAuditRulesProtected

取得布林值,指定是否保護與這個 ObjectSecurity 物件相關聯的系統存取控制清單 (SACL)。Gets a Boolean value that specifies whether the System Access Control List (SACL) associated with this ObjectSecurity object is protected.

(繼承來源 ObjectSecurity)
AuditRulesModified

取得或設定布林值,指定是否已修改與這個 ObjectSecurity 物件關聯的稽核規則。Gets or sets a Boolean value that specifies whether the audit rules associated with this ObjectSecurity object have been modified.

(繼承來源 ObjectSecurity)
AuditRuleType

取得 FileSystemSecurity 類別用來表示稽核規則的類型。Gets the type that the FileSystemSecurity class uses to represent audit rules.

(繼承來源 FileSystemSecurity)
GroupModified

取得或設定布林值,指定是否已修改與安全物件關聯的群組。Gets or sets a Boolean value that specifies whether the group associated with the securable object has been modified.

(繼承來源 ObjectSecurity)
IsContainer

取得可指定這個 ObjectSecurity 物件是否為容器物件的布林值。Gets a Boolean value that specifies whether this ObjectSecurity object is a container object.

(繼承來源 ObjectSecurity)
IsDS

取得可指定這個 ObjectSecurity 物件是否為目錄物件的布林值。Gets a Boolean value that specifies whether this ObjectSecurity object is a directory object.

(繼承來源 ObjectSecurity)
OwnerModified

取得或設定布林值,指定是否已修改安全物件的擁有者。Gets or sets a Boolean value that specifies whether the owner of the securable object has been modified.

(繼承來源 ObjectSecurity)
SecurityDescriptor

取得此執行個體的安全性描述元。Gets the security descriptor for this instance.

(繼承來源 ObjectSecurity)

方法

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.

(繼承來源 FileSystemSecurity)
AddAccessRule(AccessRule)

將指定的存取規則加入與這個 CommonObjectSecurity 物件相關聯的 Discretionary 存取控制清單 (DACL)。Adds the specified access rule to the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(繼承來源 CommonObjectSecurity)
AddAccessRule(FileSystemAccessRule)

將指定的存取控制清單 (ACL) 使用權限加入至目前的檔案或目錄。Adds the specified access control list (ACL) permission to the current file or directory.

(繼承來源 FileSystemSecurity)
AddAuditRule(AuditRule)

將指定的稽核規則加入與這個 CommonObjectSecurity 物件相關聯的系統存取控制清單 (SACL)。Adds the specified audit rule to the System Access Control List (SACL) associated with this CommonObjectSecurity object.

(繼承來源 CommonObjectSecurity)
AddAuditRule(FileSystemAuditRule)

將指定的稽核規則加入至目前的檔案或目錄。Adds the specified audit rule to the current file or directory.

(繼承來源 FileSystemSecurity)
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.

(繼承來源 FileSystemSecurity)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetAccessRules(Boolean, Boolean, Type)

取得與指定之安全識別項相關聯的存取規則集合。Gets a collection of the access rules associated with the specified security identifier.

(繼承來源 CommonObjectSecurity)
GetAuditRules(Boolean, Boolean, Type)

取得與指定之安全識別項相關聯的稽核規則集合。Gets a collection of the audit rules associated with the specified security identifier.

(繼承來源 CommonObjectSecurity)
GetGroup(Type)

取得與指定擁有者相關聯的主要群組。Gets the primary group associated with the specified owner.

(繼承來源 ObjectSecurity)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetOwner(Type)

取得與指定的主要群組關聯的擁有者。Gets the owner associated with the specified primary group.

(繼承來源 ObjectSecurity)
GetSecurityDescriptorBinaryForm()

傳回表示此 ObjectSecurity 物件之安全性描述元資訊的位元組值陣列。Returns an array of byte values that represents the security descriptor information for this ObjectSecurity object.

(繼承來源 ObjectSecurity)
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.

(繼承來源 ObjectSecurity)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
ModifyAccess(AccessControlModification, AccessRule, Boolean)

將指定的修改套用至與這個 CommonObjectSecurity 物件關聯的判別存取控制清單 (DACL)。Applies the specified modification to the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(繼承來源 CommonObjectSecurity)
ModifyAccessRule(AccessControlModification, AccessRule, Boolean)

將指定的修改套用至與這個 ObjectSecurity 物件關聯的判別存取控制清單 (DACL)。Applies the specified modification to the Discretionary Access Control List (DACL) associated with this ObjectSecurity object.

(繼承來源 ObjectSecurity)
ModifyAudit(AccessControlModification, AuditRule, Boolean)

將指定的修改套用至與這個 CommonObjectSecurity 物件關聯的系統存取控制清單 (SACL)。Applies the specified modification to the System Access Control List (SACL) associated with this CommonObjectSecurity object.

(繼承來源 CommonObjectSecurity)
ModifyAuditRule(AccessControlModification, AuditRule, Boolean)

將指定的修改套用至與這個 ObjectSecurity 物件關聯的系統存取控制清單 (SACL)。Applies the specified modification to the System Access Control List (SACL) associated with this ObjectSecurity object.

(繼承來源 ObjectSecurity)
Persist(Boolean, String, AccessControlSections)

將與這個 ObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。Saves the specified sections of the security descriptor associated with this ObjectSecurity object to permanent storage. 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(繼承來源 ObjectSecurity)
Persist(SafeHandle, AccessControlSections)

將與這個 NativeObjectSecurity 物件相關聯的安全性描述元的指定區段儲存到永久儲存體。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 建議您保留傳遞到建構函式的 includeSections 參數值,並維持方法相同。We recommend.persist that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(繼承來源 NativeObjectSecurity)
Persist(SafeHandle, AccessControlSections, Object)

將與這個 NativeObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(繼承來源 NativeObjectSecurity)
Persist(String, AccessControlSections)

將與這個 NativeObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(繼承來源 NativeObjectSecurity)
Persist(String, AccessControlSections, Object)

將與這個 NativeObjectSecurity 物件相關聯之安全性描述元的指定區段儲存到永久儲存區。Saves the specified sections of the security descriptor associated with this NativeObjectSecurity object to permanent storage. 建議傳遞至建構函式和保存方法之 includeSections 參數的值應完全相同。We recommend that the values of the includeSections parameters passed to the constructor and persist methods be identical.

(繼承來源 NativeObjectSecurity)
PurgeAccessRules(IdentityReference)

移除與指定之 IdentityReference 相關聯的所有存取規則。Removes all access rules associated with the specified IdentityReference.

(繼承來源 ObjectSecurity)
PurgeAuditRules(IdentityReference)

移除與指定之 IdentityReference 相關聯的所有稽核規則。Removes all audit rules associated with the specified IdentityReference.

(繼承來源 ObjectSecurity)
ReadLock()

鎖定這個 ObjectSecurity 物件的讀取權限。Locks this ObjectSecurity object for read access.

(繼承來源 ObjectSecurity)
ReadUnlock()

解除鎖定這個 ObjectSecurity 物件的讀取權限。Unlocks this ObjectSecurity object for read access.

(繼承來源 ObjectSecurity)
RemoveAccessRule(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯的 Discretionary 存取控制清單 (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.

(繼承來源 CommonObjectSecurity)
RemoveAccessRule(FileSystemAccessRule)

從目前的檔案或目錄中,移除所有相符的允許或拒絕存取控制清單 (ACL) 使用權限。Removes all matching allow or deny access control list (ACL) permissions from the current file or directory.

(繼承來源 FileSystemSecurity)
RemoveAccessRuleAll(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯的 Discretionary 存取控制清單 (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.

(繼承來源 CommonObjectSecurity)
RemoveAccessRuleAll(FileSystemAccessRule)

從目前的檔案或目錄中,移除指定之使用者的所有存取控制清單 (ACL) 使用權限。Removes all access control list (ACL) permissions for the specified user from the current file or directory.

(繼承來源 FileSystemSecurity)
RemoveAccessRuleSpecific(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯的 Discretionary 存取控制清單 (DACL),移除與指定存取規則完全相符的所有存取規則。Removes all access rules that exactly match the specified access rule from the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object.

(繼承來源 CommonObjectSecurity)
RemoveAccessRuleSpecific(FileSystemAccessRule)

從目前的檔案或目錄中,移除相符的單一允許或拒絕存取控制清單 (ACL) 使用權限。Removes a single matching allow or deny access control list (ACL) permission from the current file or directory.

(繼承來源 FileSystemSecurity)
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.

(繼承來源 CommonObjectSecurity)
RemoveAuditRule(FileSystemAuditRule)

從目前的檔案或目錄中,移除所有相符的允許或拒絕稽核規則。Removes all matching allow or deny audit rules from the current file or directory.

(繼承來源 FileSystemSecurity)
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.

(繼承來源 CommonObjectSecurity)
RemoveAuditRuleAll(FileSystemAuditRule)

從目前的檔案或目錄中,移除指定之使用者的所有稽核規則。Removes all audit rules for the specified user from the current file or directory.

(繼承來源 FileSystemSecurity)
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.

(繼承來源 CommonObjectSecurity)
RemoveAuditRuleSpecific(FileSystemAuditRule)

從目前的檔案或目錄中,移除相符的單一允許或拒絕稽核規則。Removes a single matching allow or deny audit rule from the current file or directory.

(繼承來源 FileSystemSecurity)
ResetAccessRule(AccessRule)

移除與這個 CommonObjectSecurity 物件相關聯之 Discretionary 存取控制清單 (DACL) 中的所有存取規則,然後加入指定的存取規則。Removes all access rules in the Discretionary Access Control List (DACL) associated with this CommonObjectSecurity object and then adds the specified access rule.

(繼承來源 CommonObjectSecurity)
ResetAccessRule(FileSystemAccessRule)

將指定的存取控制清單 (ACL) 使用權限加入至目前的檔案或目錄,並移除所有相符的 ACL 使用權限。Adds the specified access control list (ACL) permission to the current file or directory and removes all matching ACL permissions.

(繼承來源 FileSystemSecurity)
SetAccessRule(AccessRule)

從與這個 CommonObjectSecurity 物件相關聯之 Discretionary 存取控制清單 (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.

(繼承來源 CommonObjectSecurity)
SetAccessRule(FileSystemAccessRule)

設定目前檔案或目錄之指定的存取控制清單 (ACL) 使用權限。Sets the specified access control list (ACL) permission for the current file or directory.

(繼承來源 FileSystemSecurity)
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.

(繼承來源 ObjectSecurity)
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.

(繼承來源 CommonObjectSecurity)
SetAuditRule(FileSystemAuditRule)

設定目前檔案或目錄的指定稽核規則。Sets the specified audit rule for the current file or directory.

(繼承來源 FileSystemSecurity)
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.

(繼承來源 ObjectSecurity)
SetGroup(IdentityReference)

設定與 ObjectSecurity 物件相關聯的安全性描述元主要群組。Sets the primary group for the security descriptor associated with this ObjectSecurity object.

(繼承來源 ObjectSecurity)
SetOwner(IdentityReference)

設定與 ObjectSecurity 物件相關聯的安全性描述元擁有者。Sets the owner for the security descriptor associated with this ObjectSecurity object.

(繼承來源 ObjectSecurity)
SetSecurityDescriptorBinaryForm(Byte[])

從指定的位元組值陣列,設定這個 ObjectSecurity 物件的安全性描述元。Sets the security descriptor for this ObjectSecurity object from the specified array of byte values.

(繼承來源 ObjectSecurity)
SetSecurityDescriptorBinaryForm(Byte[], AccessControlSections)

從指定的位元組值陣列,設定這個 ObjectSecurity 物件之安全性描述元的指定區段。Sets the specified sections of the security descriptor for this ObjectSecurity object from the specified array of byte values.

(繼承來源 ObjectSecurity)
SetSecurityDescriptorSddlForm(String)

從指定的安全性描述元定義語言 (SDDL) 字串,設定這個 ObjectSecurity 物件的安全性描述元。Sets the security descriptor for this ObjectSecurity object from the specified Security Descriptor Definition Language (SDDL) string.

(繼承來源 ObjectSecurity)
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.

(繼承來源 ObjectSecurity)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
WriteLock()

鎖定這個 ObjectSecurity 物件的寫入權限。Locks this ObjectSecurity object for write access.

(繼承來源 ObjectSecurity)
WriteUnlock()

解除鎖定這個 ObjectSecurity 物件的寫入權限。Unlocks this ObjectSecurity object for write access.

(繼承來源 ObjectSecurity)

適用於