aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mars-attacks.org>2013-07-15 18:57:06 +0200
committerNicolas Vigier <boklm@mars-attacks.org>2013-07-15 18:59:17 +0200
commit0f6b9170d126f5c3be7bd6ee9bd8646cd2aa7d94 (patch)
treecd7c965980130bf772856636c3ff059f4874e1b7
parent852b1688fbf5129d0e365586b6d87a59fe31ba29 (diff)
downloadmgagit-0f6b9170d126f5c3be7bd6ee9bd8646cd2aa7d94.tar
mgagit-0f6b9170d126f5c3be7bd6ee9bd8646cd2aa7d94.tar.gz
mgagit-0f6b9170d126f5c3be7bd6ee9bd8646cd2aa7d94.tar.bz2
mgagit-0f6b9170d126f5c3be7bd6ee9bd8646cd2aa7d94.tar.xz
mgagit-0f6b9170d126f5c3be7bd6ee9bd8646cd2aa7d94.zip
Filter what user infos we keep from ldap
-rw-r--r--README1
-rw-r--r--config_default3
-rw-r--r--lib/MGA/Git.pm7
3 files changed, 10 insertions, 1 deletions
diff --git a/README b/README
index e411b41..d1246b9 100644
--- a/README
+++ b/README
@@ -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 {