No, it only shows groups which exist in the SQL database. I think the
step you are missing here is you need to insert the group manually
into the database, e.g.:
INSERT INTO account_groups (
owner_group_id,
group_id,
description,
automatic_membership,
name)
VALUES (
(SELECT admin_group_id FROM system_config),
nextval('account_group_id'),
'Imported from LDAP',
'Y',
'developers');
> Should Admin-
>>Projects->Access let me autocomplete LDAP group entries?
Yes, once the account_group record is created as above.
> groupBase = DC=ad,DC=xxx,DC=com
> groupMemberPattern = (&(objectClass=group)(member=${dn}))
> groupName = cn
>
> How can I do the equivalent ldapsearch command to check it? I'm not
> very familiar with LDAP. I've been trying to do commands like "(&
> (objectClass=group)(member=N*))" but whenever I put anything anything
> beside member=*, I get no results.
ldapsearch -b DC=ad,DC=xxx,DC=com '(&(objectClass=group)(member=DN))'
where DN is the distinguishedName obtained from your user account,
which can get by doing a query for that first:
ldapsearch -b DC=ad,DC=xxx,DC=com '
(&(objectClass=person)(sAMAccountName=USERNAME))'
Yes. Its the value which is stored in the property named by ldap.groupName.
> I get:
> 2009-09-25 12:00:48,114::WARN :
> com.google.gerrit.server.ldap.LdapRealm - Group "#ENG - Handset - SW
> - Product - MANAGERNAME" not found in LDAP.
>
> It seems like LdapRealm.java is trying to load from an attribute
> titled "groupName", but I don't think I have that.
That query was supposed to be:
-b "dc=ad,dc=xxx,dc=com" -s sub "(cn=#ENG - Handset - SW - Product -
MANAGERNAME)"
But its returning no results? Did you typo the group name?
> It would be useful to have this information near the ldap
> configuration in the documentation, imo. I'll try to get some time to
> add that later, once I get this working. (Or maybe I just missed it
> and it is somewhere else)
Yes, that section could use more details, including examples for
popular directory servers, like *cough*ActiveDirectory*cough*. I
would greatly appreciate any help you can offer to provide more
detailed documentation.
If the user DN has an embedded comma, escape it with the backslach "\"
escape character. For example:
'(&(objectCategory=group)(member=cn=Smith\,
James,ou=Sales,ou=West,dc=MyDomain,dc=com))'
The thing is, you have Gerrit configured right it seems:
groupMemberPattern = (&(objectClass=group)(member=${dn}))
So I'm confused. I don't see why it wouldn't be able to query the
directory. ActiveDirctory is a royal pain in the neck. If someone
manages to get this working right against ActiveDirectory it might be
nice if we could code some defaults into Gerrit and simplify the LDAP
configuration for AD users, like have a "ldap.type ActiveDirectory"
setting or something that picks up the right defaults for the patterns
and attribute names.
Its used camelCaseAsAProperty:
$ git grep -i automaticMembership
src/main/java/com/google/gerrit/client/admin/AccountGroupScreen.java:
if (group.isAutomaticMembership()) {
src/main/java/com/google/gerrit/client/reviewdb/AccountGroup.java:
protected boolean automaticMembership;
src/main/java/com/google/gerrit/client/reviewdb/AccountGroup.java:
public boolean isAutomaticMembership() {
src/main/java/com/google/gerrit/client/reviewdb/AccountGroup.java:
return automaticMembership;
src/main/java/com/google/gerrit/client/reviewdb/AccountGroup.java:
public void setAutomaticMembership(final boolean auto) {
src/main/java/com/google/gerrit/client/reviewdb/AccountGroup.java:
automaticMembership = auto;
src/main/java/com/google/gerrit/server/account/GroupCacheImpl.java:
g.setAutomaticMembership(true);
src/main/java/com/google/gerrit/server/config/SystemConfigProvider.java:
anonymous.setAutomaticMembership(true);
src/main/java/com/google/gerrit/server/config/SystemConfigProvider.java:
registered.setAutomaticMembership(true);
src/main/java/com/google/gerrit/server/ldap/LdapRealm.java: return
group.isAutomaticMembership()
src/main/java/com/google/gerrit/server/rpc/account/GroupAdminServiceImpl.java:
if (control.getAccountGroup().isAutomaticMembership()) {
src/main/java/com/google/gerrit/server/rpc/account/GroupAdminServiceImpl.java:
if (control.getAccountGroup().isAutomaticMembership()) {
src/main/java/com/google/gerrit/server/rpc/account/GroupDetailFactory.java:
if (!group.isAutomaticMembership()) {
The name automaticMembership is mapped into the database as
automatic_membership. :-)
Stupid ActiveDirectory. OK, yea, if we need to query memberOf in the
user account then its going to take a code change in LdapRealm.
Hopefully we can support either query direction.
> Part of the problem is that I've never seen it work correctly, so I'm
> probably not looking for the right signs, either. I don't see any
> error message from Gerrit, but I don't see any users in the group.
Well, there's no real error, Gerrit is issuing the query, getting 0
results back, and assumes that you aren't a member of a group. Sure,
its an error, because you know you are in at least one group, but as
far as ActiveDirectory claims to Gerrit, you aren't. :-(
> I also noticed that the "automatic_membership" column isn't referenced
> in any of the current Gerrit code. Is this just unused now?
No, it is used. Its used in the UI to decide to show the LDAP
property data below a group, rather than the group's users, and its
used in LdapRealm to decide if the group should really be assumed to
be an LDAP group, or is a group within Gerrit.