【问题标题】:Iterate through permissions on a file in the windows file system in C#在C#中遍历windows文件系统中文件的权限
【发布时间】:2014-05-11 10:01:47
【问题描述】:

我正在用 C# 开发一个应用程序。目标是获取文件系统中给定文件的权限。

这将包括继承的权限和直接分配给文件的权限。

我想获得在给定文件上分配了Read, Write, Read & Execute, List Folder Contents, Modify and Full ControlAD groupslocal groupsdomain userslocal users

我不确定如何获取给定文件的上述内容。有什么想法吗?

【问题讨论】:

    标签: c# .net windows


    【解决方案1】:

    您想为每个文件创建一个FileIOPermission 对象并选择AllFiles 成员。它可以是AllAccessAppendNoAccessPathDiscoveryReadWrite 的任意组合,但显然只有少数几个是合乎逻辑的。

    显然,您可能也对the GetPathList() method 感兴趣。

    剩下的还有System.DirectoryServices.AccountManagement namespace。这对我来说太大了,无法深入研究,但是……啊,this answer 是一个非常好的开始。

    【讨论】:

      猜你喜欢
      • 2015-10-18
      • 1970-01-01
      • 2011-10-29
      • 2014-08-28
      • 2012-02-06
      • 2023-03-16
      • 2015-12-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多