2013-01-14 13 views
0

我想爲使用C#(.NET 4.0)的特定用戶組設置AD(Active Directory,Windows Server 2008 R2)OU的List ContentList Object選項。如何以編程方式在AD OU條目上設置「列表內容」和「列表對象」權限?

我設法根據Microsoft設置gPOptionsgPLink屬性,但我沒有找到如何設置List ContentList Object一個例子。設置其他兩個屬性的作品,如下圖所示:

[...]

byte[] binaryForm = new byte[ groupPrincipal.Sid.BinaryLength ]; 
groupPrincipal.Sid.GetBinaryForm(binaryForm, 0); 
IdentityReference identityReference = 
    new SecurityIdentifier(binaryForm, 0); 
PropertyAccessRule propertyAccessRule = 
    new PropertyAccessRule(
     identityReference, 
     AccessControlType.Allow, 
     PropertyAccess.Read, 
     new Guid("...value provided by MSDN link...")); 
... 
// ouEntry is of type DirectoryEntry 
ouEntry.ObjectSecurity.AddAccessRule(propertyAccessRule); 
ouEntry.CommitChanges(); 

... 
// Same for gPLink with the corresponding GUID 

請詢問您是否需要更多的信息。

回答

0

List contentList object和必須有所不同地設置:

... 
ActiveDirectoryAccessRule activeDirectoryAccessRule = 
    new ActiveDirectoryAccessRule(
     identityReference, 
     ActiveDirectoryRights.ListChildren | ActiveDirectoryRights.ListObject, 
     AccessControlType.Allow, 
     ActiveDirectorySecurityInheritance.None); 
... 

ActiveDirectoryAccessRule必須被添加到相應的DirectoryEntry如上述的問題。

相關問題