FileSystemAccessRule 생성자

정의

FileSystemAccessRule 클래스의 새 인스턴스를 초기화합니다.

오버로드

Name Description
FileSystemAccessRule(IdentityReference, FileSystemRights, AccessControlType)

사용자 계정에 대한 참조, 액세스 규칙과 연결된 작업 유형을 지정하는 값 및 작업을 허용할지 여부를 지정하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

FileSystemAccessRule(String, FileSystemRights, AccessControlType)

사용자 계정의 이름, 액세스 규칙과 연결된 작업 유형을 지정하는 값 및 작업을 허용할지 아니면 거부할지 여부를 설명하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

FileSystemAccessRule(IdentityReference, FileSystemRights, InheritanceFlags, PropagationFlags, AccessControlType)

사용자 계정에 대한 참조, 액세스 규칙과 연결된 작업 유형을 지정하는 값, 권한이 상속되는 방식을 결정하는 값, 권한이 전파되는 방식을 결정하는 값 및 작업을 허용할지 여부를 지정하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

FileSystemAccessRule(String, FileSystemRights, InheritanceFlags, PropagationFlags, AccessControlType)

사용자 계정의 이름, 액세스 규칙과 연결된 작업 유형을 지정하는 값, 권한 상속 방법을 결정하는 값, 권한이 전파되는 방식을 결정하는 값 및 작업을 허용할지 여부를 지정하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

FileSystemAccessRule(IdentityReference, FileSystemRights, AccessControlType)

사용자 계정에 대한 참조, 액세스 규칙과 연결된 작업 유형을 지정하는 값 및 작업을 허용할지 여부를 지정하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

public:
 FileSystemAccessRule(System::Security::Principal::IdentityReference ^ identity, System::Security::AccessControl::FileSystemRights fileSystemRights, System::Security::AccessControl::AccessControlType type);
public FileSystemAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.FileSystemRights fileSystemRights, System.Security.AccessControl.AccessControlType type);
new System.Security.AccessControl.FileSystemAccessRule : System.Security.Principal.IdentityReference * System.Security.AccessControl.FileSystemRights * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.FileSystemAccessRule
Public Sub New (identity As IdentityReference, fileSystemRights As FileSystemRights, type As AccessControlType)

매개 변수

identity
IdentityReference

IdentityReference 사용자 계정에 대한 참조를 캡슐화하는 개체입니다.

fileSystemRights
FileSystemRights

FileSystemRights 액세스 규칙과 연결된 작업의 형식을 지정하는 값 중 하나입니다.

type
AccessControlType

AccessControlType 작업을 허용할지 아니면 거부할지 여부를 지정하는 값 중 하나입니다.

예외

identity 매개 변수가 개체가 IdentityReference 아닙니다.

매개 변수는 identity .입니다 null.

잘못된 열거형이 매개 변수에 type 전달되었습니다.

설명

이 생성자를 사용하여 또는 FileSecurity 클래스를 사용하여 DirectorySecurity 유지할 수 있는 액세스 제어 규칙을 만듭니다. 액세스 제어 규칙은 Microsoft Windows 실행하는 컴퓨터에서 허용되거나 허용되지 않는 작업을 결정하는 사용자 계정 권한을 정의합니다.

적용 대상

FileSystemAccessRule(String, FileSystemRights, AccessControlType)

사용자 계정의 이름, 액세스 규칙과 연결된 작업 유형을 지정하는 값 및 작업을 허용할지 아니면 거부할지 여부를 설명하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

public:
 FileSystemAccessRule(System::String ^ identity, System::Security::AccessControl::FileSystemRights fileSystemRights, System::Security::AccessControl::AccessControlType type);
public FileSystemAccessRule(string identity, System.Security.AccessControl.FileSystemRights fileSystemRights, System.Security.AccessControl.AccessControlType type);
new System.Security.AccessControl.FileSystemAccessRule : string * System.Security.AccessControl.FileSystemRights * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.FileSystemAccessRule
Public Sub New (identity As String, fileSystemRights As FileSystemRights, type As AccessControlType)

매개 변수

identity
String

사용자 계정의 이름입니다.

fileSystemRights
FileSystemRights

FileSystemRights 액세스 규칙과 연결된 작업의 형식을 지정하는 값 중 하나입니다.

type
AccessControlType

AccessControlType 작업을 허용할지 아니면 거부할지 여부를 지정하는 값 중 하나입니다.

예외

매개 변수는 identity .입니다 null.

잘못된 열거형이 매개 변수에 type 전달되었습니다.

예제

다음 코드 예제에서는 클래스를 FileSecurity 사용하여 파일에서 ACE(액세스 제어 항목)를 추가한 다음 제거합니다. 이 예제를 실행하려면 유효한 사용자 또는 그룹 계정을 제공해야 합니다.

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)
        {
            FileInfo fileInfo = new(fileName);
            FileSecurity fSecurity = fileInfo.GetAccessControl();

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

            // Set the new access settings.
            fileInfo.SetAccessControl(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)
        {
            FileInfo fileInfo = new(fileName);
            FileSecurity fSecurity = fileInfo.GetAccessControl();

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

            // Set the new access settings.
            fileInfo.SetAccessControl(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)

        Dim fileInfo As New FileInfo(fileName)
        Dim fSecurity As FileSecurity = fileInfo.GetAccessControl()

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

        fSecurity.AddAccessRule(accessRule)

        ' Set the new access settings.
        fileInfo.SetAccessControl(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)

        Dim fileInfo As New FileInfo(fileName)
        Dim fSecurity As FileSecurity = fileInfo.GetAccessControl()

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

        ' Set the new access settings.
        fileInfo.SetAccessControl(fSecurity)

    End Sub
End Module

설명

이 생성자를 사용하여 또는 FileSecurity 클래스를 사용하여 DirectorySecurity 유지할 수 있는 액세스 제어 규칙을 만듭니다. 액세스 제어 규칙은 Microsoft Windows 실행하는 컴퓨터에서 허용되거나 허용되지 않는 작업을 결정하는 사용자 계정 권한을 정의합니다.

매개 변수는 identity 현재 컴퓨터 또는 도메인에서 유효한 계정을 식별해야 합니다. 문자열은 유효한 도메인 또는 컴퓨터 이름의 DOMAIN 이름과 도메인 account또는 컴퓨터에서 유효한 사용자 계정의 이름인 다음 형식 DOMAIN\account 을 사용합니다.

적용 대상

FileSystemAccessRule(IdentityReference, FileSystemRights, InheritanceFlags, PropagationFlags, AccessControlType)

사용자 계정에 대한 참조, 액세스 규칙과 연결된 작업 유형을 지정하는 값, 권한이 상속되는 방식을 결정하는 값, 권한이 전파되는 방식을 결정하는 값 및 작업을 허용할지 여부를 지정하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

public:
 FileSystemAccessRule(System::Security::Principal::IdentityReference ^ identity, System::Security::AccessControl::FileSystemRights fileSystemRights, System::Security::AccessControl::InheritanceFlags inheritanceFlags, System::Security::AccessControl::PropagationFlags propagationFlags, System::Security::AccessControl::AccessControlType type);
public FileSystemAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.FileSystemRights fileSystemRights, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type);
new System.Security.AccessControl.FileSystemAccessRule : System.Security.Principal.IdentityReference * System.Security.AccessControl.FileSystemRights * System.Security.AccessControl.InheritanceFlags * System.Security.AccessControl.PropagationFlags * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.FileSystemAccessRule
Public Sub New (identity As IdentityReference, fileSystemRights As FileSystemRights, inheritanceFlags As InheritanceFlags, propagationFlags As PropagationFlags, type As AccessControlType)

매개 변수

identity
IdentityReference

IdentityReference 사용자 계정에 대한 참조를 캡슐화하는 개체입니다.

fileSystemRights
FileSystemRights

FileSystemRights 액세스 규칙과 연결된 작업의 형식을 지정하는 값 중 하나입니다.

inheritanceFlags
InheritanceFlags

액세스 마스크가 InheritanceFlags 자식 개체에 전파되는 방법을 지정하는 값 중 하나입니다.

propagationFlags
PropagationFlags

ACL(Access Control Entries)이 자식 개체에 전파되는 방법을 지정하는 PropagationFlags 값 중 하나입니다.

type
AccessControlType

AccessControlType 작업을 허용할지 아니면 거부할지 여부를 지정하는 값 중 하나입니다.

예외

identity 매개 변수가 개체가 IdentityReference 아닙니다.

매개 변수는 identity .입니다 null.

잘못된 열거형이 매개 변수에 type 전달되었습니다.

-또는-

잘못된 열거형이 매개 변수에 inheritanceFlags 전달되었습니다.

-또는-

잘못된 열거형이 매개 변수에 propagationFlags 전달되었습니다.

설명

이 생성자를 사용하여 또는 FileSecurity 클래스를 사용하여 DirectorySecurity 유지할 수 있는 액세스 제어 규칙을 만듭니다. 액세스 제어 규칙은 Microsoft Windows 실행하는 컴퓨터에서 허용되거나 허용되지 않는 작업을 결정하는 사용자 계정 권한을 정의합니다.

적용 대상

FileSystemAccessRule(String, FileSystemRights, InheritanceFlags, PropagationFlags, AccessControlType)

사용자 계정의 이름, 액세스 규칙과 연결된 작업 유형을 지정하는 값, 권한 상속 방법을 결정하는 값, 권한이 전파되는 방식을 결정하는 값 및 작업을 허용할지 여부를 지정하는 값을 사용하여 클래스의 새 인스턴스 FileSystemAccessRule 를 초기화합니다.

public:
 FileSystemAccessRule(System::String ^ identity, System::Security::AccessControl::FileSystemRights fileSystemRights, System::Security::AccessControl::InheritanceFlags inheritanceFlags, System::Security::AccessControl::PropagationFlags propagationFlags, System::Security::AccessControl::AccessControlType type);
public FileSystemAccessRule(string identity, System.Security.AccessControl.FileSystemRights fileSystemRights, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type);
new System.Security.AccessControl.FileSystemAccessRule : string * System.Security.AccessControl.FileSystemRights * System.Security.AccessControl.InheritanceFlags * System.Security.AccessControl.PropagationFlags * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.FileSystemAccessRule
Public Sub New (identity As String, fileSystemRights As FileSystemRights, inheritanceFlags As InheritanceFlags, propagationFlags As PropagationFlags, type As AccessControlType)

매개 변수

identity
String

사용자 계정의 이름입니다.

fileSystemRights
FileSystemRights

FileSystemRights 액세스 규칙과 연결된 작업의 형식을 지정하는 값 중 하나입니다.

inheritanceFlags
InheritanceFlags

액세스 마스크가 InheritanceFlags 자식 개체에 전파되는 방법을 지정하는 값 중 하나입니다.

propagationFlags
PropagationFlags

ACL(Access Control Entries)이 자식 개체에 전파되는 방법을 지정하는 PropagationFlags 값 중 하나입니다.

type
AccessControlType

AccessControlType 작업을 허용할지 아니면 거부할지 여부를 지정하는 값 중 하나입니다.

예외

매개 변수는 identity .입니다 null.

잘못된 열거형이 매개 변수에 type 전달되었습니다.

-또는-

잘못된 열거형이 매개 변수에 inheritanceFlags 전달되었습니다.

-또는-

잘못된 열거형이 매개 변수에 propagationFlags 전달되었습니다.

설명

이 생성자를 사용하여 또는 FileSecurity 클래스를 사용하여 DirectorySecurity 유지할 수 있는 액세스 제어 규칙을 만듭니다. 액세스 제어 규칙은 Microsoft Windows 실행하는 컴퓨터에서 허용되거나 허용되지 않는 작업을 결정하는 사용자 계정 권한을 정의합니다.

매개 변수는 identity 현재 컴퓨터 또는 도메인에서 유효한 계정을 식별해야 합니다. 문자열은 유효한 도메인 또는 컴퓨터 이름의 DOMAIN 이름과 도메인 account또는 컴퓨터에서 유효한 사용자 계정의 이름인 다음 형식 DOMAIN\account 을 사용합니다.

적용 대상