PHP LDAP查询以获取特定安全组的成员 [英] PHP LDAP query to get members of specific security Group

查看:479
本文介绍了PHP LDAP查询以获取特定安全组的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力获取LDAP查询,以便为我提供安全组的成员.

I am struggling to get an LDAP query to work to give me members of a security Group.

我们的活动目录结构是通过

Our active directory structure is set up with

DC=domain,DC=co,dc=uk 然后,我们有一个称为公司用户的OU,并且在其中有一个IT和标准的OU.

DC=domain,DC=co,dc=uk We then have a OU called Company users and within that an OU for IT,and Standard.

在其中我们创建了用户

因此我被设置为CN=my name,OU=IT,OU=company users,DC=domain,DC=co,dc=uk

安全组为CN=Test,OU=Security Group,DC=domain,DC=co,dc=uk

我是其中的成员.

我有一个PHP页面,该页面运行一个LDAP查询,该查询的DN设置为OU=Company users,DC=domain,DC=co,dc=uk,过滤器为(&(objectClass=user)(objectCategory=person)),这将返回所有用户并且运行正常.

I have a PHP page that runs an LDAP query that is set to have a DN of OU=Company users,DC=domain,DC=co,dc=uk with a filter of (&(objectClass=user)(objectCategory=person)) and this returns all users and works fine.

尽管我似乎已经尝试过Google给我的每条查询,但我还是无法返回它仅返回Test组的成员.

I can not however get it to return just members of my Test group even though I seem to have tried every query Google has given me.

我认为这是由于我们如何建立结构.

I think it is due to how we have the structure set up.

任何人都可以帮忙.

推荐答案

您可以执行以下操作:

(&(objectClass=user)(objectCategory=person)(memberof=CN=Test,OU=Security Group,DC=domain,DC=co,dc=uk))

在您的过滤器中,这将带出正确的用户.如果不正确,则可能要在域控制器上签出ADSI Edit程序,这将为您提供正确的DN.

in your filter, this will then bring out the correct users. If this is incorrect you might want to check out the ADSI Edit program on the Domain controller, this will give you the correct DN.

我希望这会有所帮助,祝你好运

I hope this helps, good luck

这篇关于PHP LDAP查询以获取特定安全组的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆