2013-07-19
展开全部
List<FileSystemRights> ret = new List<FileSystemRights>();
DirectorySecurity dirSec = Directory.GetAccessControl(@"c:\test", AccessControlSections.All);
AuthorizationRuleCollection rules = dirSec.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule rule in rules)
{
ret.Add(rule.FileSystemRights);
}
ret里面就是各个帐号对该目录的访问权限,你在里面判断一下就知道了,格式是这样的:
ReadData | WriteData | AppendData | ReadExtendedAttributes | WriteExtendedAttributes | ExecuteFile | DeleteSubdirectoriesAndFiles | ReadAttributes | WriteAttributes | Delete | ReadPermissions | ChangePermissions | TakeOwnership | Synchronize
DirectorySecurity dirSec = Directory.GetAccessControl(@"c:\test", AccessControlSections.All);
AuthorizationRuleCollection rules = dirSec.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule rule in rules)
{
ret.Add(rule.FileSystemRights);
}
ret里面就是各个帐号对该目录的访问权限,你在里面判断一下就知道了,格式是这样的:
ReadData | WriteData | AppendData | ReadExtendedAttributes | WriteExtendedAttributes | ExecuteFile | DeleteSubdirectoriesAndFiles | ReadAttributes | WriteAttributes | Delete | ReadPermissions | ChangePermissions | TakeOwnership | Synchronize
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询