【发布时间】:2014-08-28 14:25:04
【问题描述】:
我有一份简单的工作,但我不知道如何完成,随着搜索的深入,我迷失得更深。
我需要编写一个方法,通过给定的文件夹路径返回给定用户的FileSystemAccessRule(我得到了他的 samAccountName,objectGUID)。
我已经完成了向路径添加或删除 FileSystemAccessRule 的操作,如下所示:
var fSecurity = Directory.GetAccessControl(physicalPath);
fSecurity.AddAccessRule(new FileSystemAccessRule(samAccountName, FileSystemRights.FullControl, AccessControlType.Allow));
fSecurity.RemoveAccessRule(new FileSystemAccessRule(samAccountName, FileSystemRights.FullControl, AccessControlType.Allow));
Directory.SetAccessControl(physicalPath, fSecurity);
检查给定用户是否对路径具有某种特定的访问权限是一项类似的工作?还是应该走别的路? DirectoryEntry 或 LDAP 或 Active Directory 之类的?
我想要的是一个可能看起来像这样的方法:
FileSystemAccessRule[] GetAccessRulesOfTheUserOverPath(string samAccountName, string folderPath)
{
/// how?
}
【问题讨论】:
标签: security active-directory directory ldap filesystems