diff --git a/doc/administration/auth/ldap/ldap-troubleshooting.md b/doc/administration/auth/ldap/ldap-troubleshooting.md index b8391bec72f01ba75579a429f11ee1feb27928c1..5c5d5aaffe8b897de344c1efe8121efeaa4b90b5 100644 --- a/doc/administration/auth/ldap/ldap-troubleshooting.md +++ b/doc/administration/auth/ldap/ldap-troubleshooting.md @@ -71,7 +71,28 @@ options = { filter: Net::LDAP::Filter.eq('cn', '*'), # :attributes is optional - # the attributes we want to get returnedk + # the attributes we want to get returned + attributes: %w(dn cn memberuid member submember uniquemember memberof) +} +adapter.ldap_search(options) +``` + +When using OIDs in the filter, replace `Net::LDAP::Filter.eq` with `Net::LDAP::Filter.construct`: + +```ruby +adapter = Gitlab::Auth::Ldap::Adapter.new('ldapmain') +options = { + # :base is required + # use .base or .group_base + base: adapter.config.base, + + # :filter is optional + # This filter includes OID 1.2.840.113556.1.4.1941 + # It will search for all direct and nested members of the group gitlab_grp in the LDAP directory + filter: Net::LDAP::Filter.construct("(memberOf:1.2.840.113556.1.4.1941:=CN=gitlab_grp,DC=example,DC=com)"), + + # :attributes is optional + # the attributes we want to get returned attributes: %w(dn cn memberuid member submember uniquemember memberof) } adapter.ldap_search(options)