FileSystemRights 列挙体とは? わかりやすく解説

FileSystemRights 列挙体

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

アクセス規則監査規則作成時に使用するアクセス権定義します

この列挙体には、メンバ値のビットごとの組み合わせ可能にする FlagsAttribute 属性含まれています。

名前空間: System.Security.AccessControl
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<FlagsAttribute> _
Public Enumeration FileSystemRights
Dim instance As FileSystemRights
[FlagsAttribute] 
public enum FileSystemRights
[FlagsAttribute] 
public enum class FileSystemRights
/** @attribute FlagsAttribute() */ 
public enum FileSystemRights
FlagsAttribute 
public enum FileSystemRights
メンバメンバ
 メンバ説明
AppendDataファイル末尾データ追加する権限指定します。 
ChangePermissionsファイルまたはフォルダ関連付けられたセキュリティ規則監査規則変更する権限指定します。 
CreateDirectoriesフォルダ作成する権限指定します。  

この権限には Synchronize 値が必要です。ファイルまたはフォルダ作成時に Synchronize 値を明示的に設定しない場合Synchronize 値は自動的に設定されます。

CreateFilesファイル作成する権限指定します。  

この権限には Synchronize 値が必要です。ファイルまたはフォルダ作成時に Synchronize 値を明示的に設定しない場合Synchronize 値は自動的に設定されます。

Deleteフォルダまたはファイル削除する権限指定します。  
DeleteSubdirectoriesAndFilesフォルダおよびそのフォルダ内に格納されているファイル削除する権限指定します。 
ExecuteFileアプリケーション ファイル実行する権限指定します。 
FullControlフォルダまたはファイルに対してフル コントロール行いアクセス制御と監査規則変更する権限指定します。この値は、ファイルに対してどのような操作でも行うことができる権限を表します。この値は、この列挙体のすべての権限組み合わせたものです。 
ListDirectoryディレクトリ内容読み取る権限指定します。 
Modify読み取り書き込みフォルダ内容の一覧表示フォルダファイル削除、およびアプリケーション ファイル実行を行う権限指定します。この権限には、ReadAndExecute 権限Write 権限、および Delete 権限含まれます。 
Readフォルダまたはファイル読み取り専用として開いたり、コピーしたりする権限指定します。この権限には、ReadData 権限、ReadExtendedAttributes 権限、ReadAttributes 権限、および ReadPermissions 権限含まれます。 
ReadAndExecuteフォルダまたはファイル読み取り専用として開いたコピーしたりする権限、およびアプリケーション ファイル実行する権限指定します。この権限には、Read 権限および ExecuteFile 権限含まれます。 
ReadAttributesフォルダまたはファイルファイル システム属性開いたり、コピーしたりする権限指定します。たとえば、この値は、ファイル作成日変更日表示する権限指定します。これには、データ拡張ファイル システム属性、またはアクセス規則監査規則読み取る権限含まれません。 
ReadDataファイルまたはフォルダ開いたり、コピーしたりする権限指定します。これには、ファイル システム属性拡張ファイル システム属性、またはアクセス規則監査規則読み取る権限含まれません。 
ReadExtendedAttributesフォルダまたはファイル拡張ファイル システム属性開いたり、コピーしたりする権限指定します。たとえば、この値は、作成者内容に関する情報表示する権限指定します。これには、データファイル システム属性、またはアクセス規則監査規則読み取る権限含まれません。 
ReadPermissionsフォルダまたはファイルアクセス規則監査規則開いたり、コピーしたりする権限指定します。これには、データファイル システム属性、および拡張ファイル システム属性読み取る権限含まれません。  
Synchronizeファイル ハンドルI/O 操作完了同期するまでアプリケーション待機できるかどうか指定します。 

Synchronize 値は、アクセス許可する自動的に設定されアクセス拒否する自動的に除外されます。

ファイルまたはフォルダ作成する権限には、この値が必要です。この値は、ファイル作成時に明示的に設定しなくても、自動的に設定されます。

TakeOwnershipフォルダまたはファイル所有者変更する権限指定しますリソース所有者は、そのリソースに対してフル アクセス権限を持ちます。 
Traverseフォルダ内容一覧表示し、そのフォルダ格納されているアプリケーション実行する権限指定します。 
Writeフォルダおよびファイル作成しファイルに対してデータ追加または削除を行う権限指定します。この権限には、WriteData 権限、AppendData 権限、WriteExtendedAttributes 権限、および WriteAttributes 権限含まれます。  
WriteAttributesフォルダまたはファイルファイル システム属性開いたり、フォルダまたはファイルファイル システム属性書き込んだりする権限指定します。これには、データ拡張属性、またはアクセス規則監査規則書き込む権限含まれません。 
WriteDataファイルまたはフォルダ開いたり、ファイルまたはフォルダ書き込んだりする権限指定します。これには、ファイル システム属性拡張ファイル システム属性、またはアクセス規則監査規則開いた書き込んだりする権限含まれません。 
WriteExtendedAttributesフォルダまたはファイル拡張ファイル システム属性開いたり、フォルダまたはファイル拡張ファイル システム属性書き込んだりする権限指定します。これには、データ属性、またはアクセス規則監査規則書き込む権限含まれません。 
解説解説
使用例使用例

FileSystemRights 列挙体を使用してファイルアクセス規則指定し次にそのアクセス規則削除するコード例次に示します。この例を実行するには、有効なユーザーまたはグループ アカウント指定する必要があります

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)

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

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

    End Sub
End Module
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);

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

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

        }
    }
}
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 to 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);
    }
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
System.Security.AccessControl 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からFileSystemRights 列挙体を検索した結果を表示しています。
Weblioに収録されているすべての辞書からFileSystemRights 列挙体を検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からFileSystemRights 列挙体 を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「FileSystemRights 列挙体」の関連用語

FileSystemRights 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



FileSystemRights 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS