Browse Source

update core

Support IT MAJ 2 months ago
parent
commit
34c27357e8
1 changed files with 14 additions and 18 deletions
  1. 14 18
      system/settings.py

+ 14 - 18
system/settings.py

@@ -11,8 +11,8 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
 """
 
 from pathlib import Path
-#import ldap
-#from django_auth_ldap.config import LDAPSearch
+import ldap
+from django_auth_ldap.config import LDAPSearch
 
 # Build paths inside the project like this: BASE_DIR / 'subdir'.
 BASE_DIR = Path(__file__).resolve().parent.parent
@@ -62,22 +62,22 @@ MIDDLEWARE = [
 	'django.middleware.clickjacking.XFrameOptionsMiddleware',
 ]
 
-# AUTH_LDAP_SERVER_URI = "ldap://172.16.106.102"
-# AUTH_LDAP_BIND_DN = "seafile.adm@intra.stjacques"
-# AUTH_LDAP_BIND_PASSWORD = "DxbYwD5V2t"
-# AUTH_LDAP_USER_SEARCH = LDAPSearch("OU=Informatique,OU=Administratif,Ou=Gentilly,OU=Utilisateurs,DC=intra,DC=stjacques", ldap.SCOPE_SUBTREE, "(sAMAccountName=%(user)s)")
+AUTH_LDAP_SERVER_URI = "ldap://10.8.100.15"
+AUTH_LDAP_BIND_DN = "ldapglpi@majorelle.local"
+AUTH_LDAP_BIND_PASSWORD = "4rIq4B9CGlZm9gq!"
+AUTH_LDAP_USER_SEARCH = LDAPSearch("OU=INFORMATIQUE,OU=RDC,OU=MAJ,DC=majorelle,DC=local", ldap.SCOPE_SUBTREE, "(sAMAccountName=%(user)s)")
 
-# AUTH_LDAP_USER_ATTR_MAP = {
-# 	"first_name": "givenName",
-# 	"last_name": "sn",
-# 	"email": "mail",
-# 	"username": "sAMAccountName",
-# }
+AUTH_LDAP_USER_ATTR_MAP = {
+	"first_name": "givenName",
+	"last_name": "sn",
+	"email": "mail",
+	"username": "sAMAccountName",
+}
 
-# AUTH_LDAP_ALWAYS_UPDATE_USER = True
+AUTH_LDAP_ALWAYS_UPDATE_USER = True
 
 AUTHENTICATION_BACKENDS = [
-	# "django_auth_ldap.backend.LDAPBackend",
+	"django_auth_ldap.backend.LDAPBackend",
 	"django.contrib.auth.backends.ModelBackend",
 ]
 
@@ -106,10 +106,6 @@ WSGI_APPLICATION = 'system.wsgi.application'
 # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
 
 DATABASES = {
-# 	'default': {
-# 		'ENGINE': 'django.db.backends.sqlite3',
-# 		'NAME': BASE_DIR / 'db.sqlite3',
-# 	}
     'default': {
 	 	'ENGINE': 'django.db.backends.mysql',
 	 	'NAME': 'gestclin', # db name