aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2010-12-15 21:24:26 +0000
committerMichael Scherer <misc@mageia.org>2010-12-15 21:24:26 +0000
commitc41357a607659099be05c5ada092cf343b08560c (patch)
tree87f49f61cea32e31422d8ae14c50aaeae206d8c5 /modules
parentdb6bb8f84629ddac88b1e658da946a3f595e013f (diff)
downloadpuppet-c41357a607659099be05c5ada092cf343b08560c.tar
puppet-c41357a607659099be05c5ada092cf343b08560c.tar.gz
puppet-c41357a607659099be05c5ada092cf343b08560c.tar.bz2
puppet-c41357a607659099be05c5ada092cf343b08560c.tar.xz
puppet-c41357a607659099be05c5ada092cf343b08560c.zip
allow to use email on log on transifex
Diffstat (limited to 'modules')
-rw-r--r--modules/transifex/files/custom_backend.py9
-rw-r--r--modules/transifex/manifests/init.pp12
-rw-r--r--modules/transifex/templates/45-ldap.conf4
3 files changed, 22 insertions, 3 deletions
diff --git a/modules/transifex/files/custom_backend.py b/modules/transifex/files/custom_backend.py
new file mode 100644
index 00000000..828744fb
--- /dev/null
+++ b/modules/transifex/files/custom_backend.py
@@ -0,0 +1,9 @@
+
+from django_auth_ldap.backend import LDAPBackend,_LDAPUser
+
+class ForceUidLDAPBackend(LDAPBackend):
+ def ldap_to_django_username(self, username):
+ # force uid if someone give a email
+ return _LDAPUser(self, username=username).attrs['uid'][0]
+
+
diff --git a/modules/transifex/manifests/init.pp b/modules/transifex/manifests/init.pp
index 88e9a34a..d3d2ead2 100644
--- a/modules/transifex/manifests/init.pp
+++ b/modules/transifex/manifests/init.pp
@@ -74,6 +74,16 @@ class transifex {
notify => Service['apache']
}
+ file { "custom_backend.py":
+ path => "/usr/local/lib/custom_backend.py",
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 644,
+ source => "puppet:///modules/transifex/custom_backend.py",
+ notify => Service['apache']
+ }
+
subversion::snapshot { $templates_dir:
source => "svn://svn.mageia.org/svn/web/templates/transifex/trunk"
}
@@ -81,7 +91,7 @@ class transifex {
apache::vhost_django_app { "transifex.$domain":
module => "transifex",
use_ssl => true,
- module_path => ["/usr/share/transifex","/usr/share"]
+ module_path => ["/usr/share/transifex","/usr/share","/usr/local/lib/"]
}
apache::vhost_redirect_ssl { "transifex.$domain": }
diff --git a/modules/transifex/templates/45-ldap.conf b/modules/transifex/templates/45-ldap.conf
index ea487d70..e3e3877d 100644
--- a/modules/transifex/templates/45-ldap.conf
+++ b/modules/transifex/templates/45-ldap.conf
@@ -1,5 +1,5 @@
AUTHENTICATION_BACKENDS = (
- 'django_auth_ldap.backend.LDAPBackend',
+ 'custom_backend.ForceUidLDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
@@ -23,7 +23,7 @@ AUTH_LDAP_BIND_DN = "cn=alamut-sympa,ou=System Accounts,<%= dc_suffix %>"
AUTH_LDAP_BIND_PASSWORD = "<%= ldap_password %>"
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=People,<%= dc_suffix %> ",
- ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
+ ldap.SCOPE_SUBTREE, "(|(uid=%(user)s)(mail=%(user)s))")
# Set up the basic group parameters.
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=Group,<%= dc_suffix %>",