[Mageia-sysadm] [632] allow to use email on log on transifex

root at mageia.org root at mageia.org
Wed Dec 15 22:24:26 CET 2010


Revision: 632
Author:   misc
Date:     2010-12-15 22:24:26 +0100 (Wed, 15 Dec 2010)
Log Message:
-----------
allow to use email on log on transifex

Modified Paths:
--------------
    puppet/modules/transifex/manifests/init.pp
    puppet/modules/transifex/templates/45-ldap.conf

Added Paths:
-----------
    puppet/modules/transifex/files/
    puppet/modules/transifex/files/custom_backend.py

Added: puppet/modules/transifex/files/custom_backend.py
===================================================================
--- puppet/modules/transifex/files/custom_backend.py	                        (rev 0)
+++ puppet/modules/transifex/files/custom_backend.py	2010-12-15 21:24:26 UTC (rev 632)
@@ -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]
+
+

Modified: puppet/modules/transifex/manifests/init.pp
===================================================================
--- puppet/modules/transifex/manifests/init.pp	2010-12-15 16:15:46 UTC (rev 631)
+++ puppet/modules/transifex/manifests/init.pp	2010-12-15 21:24:26 UTC (rev 632)
@@ -74,6 +74,16 @@
     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 @@
   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": }

Modified: puppet/modules/transifex/templates/45-ldap.conf
===================================================================
--- puppet/modules/transifex/templates/45-ldap.conf	2010-12-15 16:15:46 UTC (rev 631)
+++ puppet/modules/transifex/templates/45-ldap.conf	2010-12-15 21:24:26 UTC (rev 632)
@@ -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_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 %>",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101215/6212bd03/attachment.html>


More information about the Mageia-sysadm mailing list