[英]Iterate through permissions on a file in the windows file system in C#
I am developing an application in C#. 我正在用C#开发应用程序。 The goal is to get the permissions on a given file in the file system.
目的是获得文件系统中给定文件的权限。
This would include inherited permissions and permissions directly assigned to the file. 这将包括继承的权限和直接分配给文件的权限。
I want to get AD groups
, local groups
and domain users
and local users
who have been assigned Read, Write, Read & Execute, List Folder Contents, Modify and Full Control
on a given file. 我想获取
AD groups
, local groups
和domain users
以及已分配给定文件的Read, Write, Read & Execute, List Folder Contents, Modify and Full Control
domain users
local users
。
I am not sure how to get the above for a given file. 我不确定如何获取给定文件的以上内容。 Any ideas ?
有任何想法吗 ?
You want to create a FileIOPermission
object for each file and pick out the AllFiles
member. 您要为每个文件创建一个
FileIOPermission
对象,并挑选AllFiles
成员。 It can be any combination of AllAccess
, Append
, NoAccess
, PathDiscovery
, Read
, and Write
, though obviously only a few of those make logical sense. 它可以是
AllAccess
, Append
, NoAccess
, PathDiscovery
, Read
和Write
任意组合,尽管显然只有少数几个具有逻辑意义。
You might also be interested in the GetPathList()
method , obviously. 显然,您可能也对
GetPathList()
方法感兴趣。
For the rest, there's also the System.DirectoryServices.AccountManagement
namespace . 其余的还有
System.DirectoryServices.AccountManagement
命名空间 。 That'd be too big for me to dig into, here, but...ah, this answer is a really good start. 这对于我来说太大了,但是...嗯, 这个答案是一个很好的开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.