我写了一个简单的代码来检索文件夹的安全信息
该信息包含用户和组以及它们对文件夹的权限
该信息包含用户和组以及它们对文件夹的权限
public void GetSecurityRules(DirectoryInfo directoryInfo) { DirectorySecurity DSecurity = directoryInfo.GetAccessControl(); AuthorizationRuleCollection Rules = DSecurity.GetAccessRules(true,true,typeof(NTAccount)); foreach (FileSystemAccessRule fileSystemAccessRule in Rules) { Console.WriteLine("User/Group name {0}",fileSystemAccessRule.IdentityReference.Value); Console.WriteLine("Permissions: {0}",fileSystemAccessRule.FileSystemRights.ToString()); } }
在行fileSystemAccessRule.IdentityReference.Value中,我同时获得了用户和组,但我怎么知道该值是代表用户还是组?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。