aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 %>",