首页 > 解决方案 > c# DirectoryEntrie 属性 allowedAttributesEffective 始终为空

问题描述

我有一个非常古老的项目,多年来一直像魅力一样工作。
突然之间似乎下面的代码片段只返回false,因为“allowedAttributesEffective”属性为空,因此认为用户无权修改AD对象

public static bool checkWritePermission(DirectoryEntry de) {
  de.RefreshCache(new string[] { "allowedAttributesEffective" });
  log.write("Write permission == " + (bool)(de.Properties["allowedAttributesEffective"].Value != null), 5);  
  // Outputs always -> "Write permission == False"  
  return de.Properties["allowedAttributesEffective"].Value != null;
}

多年前从这里获取的“原始”代码:如何使用 C# 检查用户是否在 Active Directory 中具有写入权限?

实际上,执行此代码的用户应该对所有 AD 对象具有修改权限(事实证明,我可以通过 Active Directory 用户和计算机管理界面修改所有有问题的对象)

任何想法可能是什么问题?
我还尝试在 linux 上使用 ldapsearch 来查看是否可以读取属性“allowedAttributesEffective”,但我还没有找到明确的答案,因为它没有在任何 LDAP 对象上返回任何内容

标签: c#permissionsactive-directoryldap

解决方案


推荐阅读