c# - 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# - 如何在 Angular 中使用 typescript 根据下拉值显示名称值?
- javascript - 在 Node / Electron 环境中共享 ESM“.js”模块
- angular - 将特定表单添加到 *ngFor 中的项目
- c# - 每次程序向文件 C# 输入新字符串时,编写新的代码行
- graph - 如何在图表中包含“引用”属性/属性?
- graphql - 关于模式拼接的自定义指令
- java - Spring Test:数据库在测试中被初始化两次
- python - Python SQL 数据到数组(如 csv)
- c# - 使用图片框引发 System.ArgumentException
- r - 如何将数据集划分为 R 中所有可能的测试和训练组合?