diff options
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | config_default | 3 | ||||
-rw-r--r-- | lib/MGA/Git.pm | 7 |
3 files changed, 10 insertions, 1 deletions
@@ -35,6 +35,7 @@ The following configuration options are available : userbase: the base used to search ldap users userfilter: filter to search ldap users uid_username_re: regular expression to extract a username from ldap uid + ldap_users_infos: list of ldap user attributes that we should keep available group_re: regular expression to extract group name from cn pubkey_dir: directory containing users ssh keys, used by gitolite tmpl_dir: templates directory diff --git a/config_default b/config_default index d51aca8..a980bef 100644 --- a/config_default +++ b/config_default @@ -17,3 +17,6 @@ repos_config: - prefix: software include_dir: /var/lib/git/repos/software gl_template: soft_repo +ldap_users_infos: + - cn + - sshpublickey diff --git a/lib/MGA/Git.pm b/lib/MGA/Git.pm index e518189..6b8ac11 100644 --- a/lib/MGA/Git.pm +++ b/lib/MGA/Git.pm @@ -111,7 +111,12 @@ sub load_users { filter => $config->{userfilter}, ); my @users = grep { $_->{sshpublickey} } values %{$m->as_struct}; - @{$r->{users}}{map { $_->{uid}[0] } @users} = @users; + my %keepinfos = map { $_ => 1 } @{$config->{ldap_users_infos}}; + foreach my $user (@users) { + my $uid = $user->{uid}[0]; + my %u = map { $keepinfos{$_} ? ($_ => $user->{$_}) : () } keys %$user; + $r->{users}{$uid} = \%u; + } } sub get_tmpl { |