在Active Directory中,如何确定ActiveDirectoryAccessRule的类型?
我可以使用诸如的代码获取Active Directory对象的访问规则集合
ActiveDirectorySecurity ads = directoryEntry.ObjectSecurity; AuthorizationRuleCollection arc = ads.GetAccessRules(true, true, typeof(NTAccount)); foreach (ActiveDirectoryAccessRule adar in arc) { // get rule properties }
但是,我想知道每条规则是否也属于ActiveDirectoryAccessRule子类型之一,例如PropertyAccessRule。
这可能吗? 我没有看到提供此信息的类属性。
你可以用来检查类型 – 例如:
if (adar is System.DirectoryServices.PropertyAccessRule ) { // do whatever you need to do if it is a PropertyAccessRule... }
您可以使用以下命令执行此操作,因为所有都inheritance自ActiveDirectoryAccessRule
:
System.DirectoryServices.CreateChildAccessRule System.DirectoryServices.DeleteChildAccessRule System.DirectoryServices.DeleteTreeAccessRule System.DirectoryServices.ExtendedRightAccessRule System.DirectoryServices.ListChildrenAccessRule System.DirectoryServices.PropertyAccessRule System.DirectoryServices.PropertySetAccessRule
- 从AD获取扩展属性?
- UserPrincipal.FindByIdentity中的.NET 4.5错误(System.DirectoryServices.AccountManagement)
- 从WindowsIdentity和Thread.CurrentPrincipal检索WindowsPrincipal有什么区别?
- 在C#中,如何访问Active Directory以获取某个用户所属的组列表?
- 在ASP.NET Core中使用DirectoryServices
- 如何克服Active Directory搜索中的后期绑定
- 检测使用ASP.NET应用程序登录计算机的用户
- 从多个林环境中获取Domain Local Group的所有成员
- 如何使用c#使用DomainName获取AD中的OU名称列表?