FileSecurity 類別

定義

表示檔案的存取控制和稽核安全性。Represents the access control and audit security for a file. 此類別無法獲得繼承。This class cannot be inherited.

public ref class FileSecurity sealed : System::Security::AccessControl::FileSystemSecurity
public sealed class FileSecurity : System.Security.AccessControl.FileSystemSecurity
[System.Security.SecurityCritical]
public sealed class FileSecurity : System.Security.AccessControl.FileSystemSecurity
type FileSecurity = class
    inherit FileSystemSecurity
[<System.Security.SecurityCritical>]
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.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 類別的新執行個體。Initializes a new instance of the FileSecurity class.

FileSecurity(String, AccessControlSections)

使用 FileSecurity 列舉型別 (Enumeration) 之指定的值,從指定的檔案初始化 AccessControlSections 類別的新執行個體。Initializes a new instance of the FileSecurity class from a specified file 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 的淺層複製。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)

適用於