OpenDirectory / LDAP查询语法来查找GADS组中的所有用户

我想构build一个LDAP查询来查找属于我的OS X 10.9服务器上的“Google Apps用户”组(简称:googleappsusers)的所有用户。 当我在Google Apps Directory Sync(GADS)中运行以下查询时,它将返回零个用户,尽pipe事实上我确实在googleappsusers组中有一个用户。

(&(objectCategory=users)(memberOf=cn=googleappsusers,cn=groups,dc=nyc1,dc=domain,dc=com)) 

Apple Open Directory不使用memberOf用户属性(OSX Server 10.7.5)。

相反,它完全依赖于memberUid组属性来枚举给定组成员的用户。 因此,不能通过查询用户对象来确定用户组成员资格,而是如果希望用户特定组成员资格的完整列表,则必须枚举与该用户对应的memberUid属性的所有组。

当然,我们可以修改模式来添加memberOf属性,但是还必须执行保持组memberUU属性值和用户memberOf属性值同步的必要工作。

这与支持memberOf用户属性的ldap实现不同,后者包含用于保持属性对值同步的机制(Microsoft Active Directory,带有memberOf覆盖的OpenLDAP)。

第28页的[Google Apps Directory Syncpipe理指南] [1]指出:

 There are three ways to mark your Google Apps users in LDAP: • OU: Set up an organizational unit (OU) and move Google Apps users into that unit. • Group: Create a new group in LDAP, and add Google Apps users as a member of that group. • Custom Attribute: Create a custom attribute for your users, and set that attribute for new users. 

我的猜测是你可以通过任何一个来解决这个任务,但是查询用户的memberOf只有在你自己将memberOf属性添加到你的用户对象时才能使用。 它被视为一个开放目录的自定义属性。

有些属性在ldap对象中是空的,这不是一个值得关注的问题,只是意味着它们被包含在ldap模式中,但是它们的值没有被设置为ldap对象。 在任何开箱即用的ldap实现中,您都会看到类似的情况。

[1] http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/zh/cn/support/enterprise/static/gapps/docs/admin/en/gads/admin/gads_admin.pdf

我通常使用Softerras LDAP Browser来浏览LDAP树,以便更快地find正确的语法/path。 有很多免费的ldap浏览器,这只是我在线路上find的一个,并没有麻烦交换。

看起来,如果你有一个mac客户端也有一些osx的替代品: http : //en.m.wikipedia.org/wiki/List_of_LDAP_software