English 中文(简体)
使用系统. 安全.AccessControl,如果目标组群的规模非常大,则从多个轴心中删除ACE是非常缓慢的。
原标题:Using System.Security.AccessControl to remove an ACE from a folder ACL is very slow if the target folder size is very large

我需要将某些账户(如“人人”的托管人或使每个人都能接触到文件夹的某个全球集团)从ACL中删除。 我收到一份<条码>名录安全物体、通过<条码>授予和通过<条码>星座<>条码>,从《欧洲空间法》中删除<条码>,然后我请<条码>SetAccessControl适用改动。 如果目标文件夹小,但如果有许多儿童文件夹和档案,可以永远适用这些变化(比手工操作更长)。 我只想谈谈《欧洲常规武装力量条约》的目标。 是否有办法利用.Directory Security做到这一点。 课程 或者,我是否必须利用Win32的预报或其他一些解决办法?

这里是一部法典。 电话dirInfo.SetAccessControl(dirSec)是盒式尺寸非常大时的hang点。

DirectoryInfo dirInfo = new DirectoryInfo(path);
DirectorySecurity dirSec = dirInfo.GetAccessControl();
AuthorizationRuleCollection acl = dirSec.GetAccessRules(true, true,     
                                  typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule ace in acl)
{
    if (groupsToRemove.Contains(ace.IdentityReference.Value))
    {
        dirSec.RemoveAccessRuleSpecific(ace);
        dirInfo.SetAccessControl(dirSec);
    }
}
最佳回答
DirectoryInfo dirInfo = new DirectoryInfo(path);
DirectorySecurity dirSec = dirInfo.GetAccessControl();
AuthorizationRuleCollection acl = dirSec.GetAccessRules(true, true,     
                                  typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule ace in acl)
{
    if (groupsToRemove.Contains(ace.IdentityReference.Value))
    {
        dirSec.RemoveAccessRuleSpecific(ace);
        dirInfo.SetAccessControl(dirSec);
    }
}

您的法典中,你正在对《刑法》进行更新,对你们的住所进行各种干扰,这非常昂贵。 您是否尝试在<条形码>上移动。 本条应采用<代码>SetAccessControl,在您的上采用/code>。

foreach (FileSystemAccessRule ace in acl)
{
    if (groupsToRemove.Contains(ace.IdentityReference.Value))
    {
        dirSec.RemoveAccessRuleSpecific(ace);        
    }
}
dirInfo.SetAccessControl(dirSec);
问题回答

页: 1 SE_DACL_PROTECTED 旗帜是为了“防止母集装箱的DACL上设定的CE,以及从适用于标的DACL>的母集装箱上的任何物体。 这样做可能加快你的工作,因为它不必适用所有的儿童目标。 还来自MSDN,

Be aware that the SE_DACL_PRESENT flag must be present to set SE_DACL_PROTECTED and SE_SACL_PRESENT must be present to set SE_SACL_PROTECTED.

然后,你必须使用。 IADs Security Descriptor.Control property to control whether DACLs and SACLs are persistent by the Object from its soil.

http://msdn.microsoft.com/en-us/library/a706128v=vs.85%29.aspx”rel=“nofollow” IADs Security Descriptor 接口。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...