aboutsummaryrefslogtreecommitdiffstats
path: root/modules/django_application/files
diff options
context:
space:
mode:
Diffstat (limited to 'modules/django_application/files')
-rw-r--r--modules/django_application/files/custom_backend.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/django_application/files/custom_backend.py b/modules/django_application/files/custom_backend.py
new file mode 100644
index 00000000..828744fb
--- /dev/null
+++ b/modules/django_application/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]
+
+