首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何验证对的访问?

如何验证对的访问?
EN

Stack Overflow用户
提问于 2016-12-02 09:46:35
回答 1查看 101关注 0票数 1

我正在进行某种健康监测,我想验证我的应用程序在Active Directory中是否有访问权限和正确的权限。当我初始化DirectoryEntry时,这将显示我从机器上看到给定的域/路径。没关系,但我需要检查我是否能够在域中读写。在AD中即使不创建实际对象也是可能的吗?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-08 16:10:26

最后,奥多夫特的评论非常容易。下面是我使用的代码:

代码语言:javascript
复制
                using (DirectoryEntry entry = directorySearcher.FindOne()?.GetDirectoryEntry())
                {
                    if (entry == null)
                    {
                        //report error
                    }

                    entry.RefreshCache(new string[] { "allowedAttributesEffective" });
                    if (entry.Properties["allowedAttributesEffective"].Value != null)
                    {
                        if (this.properties == null || this.properties.All(property => entry.Properties["allowedAttributesEffective"].Contains(property)))
                        {
                            //sufficient rights
                        }
                        else
                        {
                            //insufficient rights
                        }
                    }
                    else
                    {
                        //not possible to check attribute "allowedAttributesEffective", it is missing or you have insufficient rights to read it
                    }
                }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40929103

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档