From 0df044b267ff87bd19562832b39917f84977f2b7 Mon Sep 17 00:00:00 2001 From: d42 Date: Wed, 10 Oct 2018 21:28:57 +0200 Subject: [PATCH] ldap is no more ['] --- requirements.txt | 2 -- spejstore/settings.py | 38 -------------------------------------- 2 files changed, 40 deletions(-) diff --git a/requirements.txt b/requirements.txt index ba2f8a5..8f673f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,13 +6,11 @@ git+https://github.com/d42/django-tree@687c01c02d91cada9ca1912e34e482da9e73e27a# django-appconf==1.0.2 django-flat-responsive==2.0 social-auth-app-django==2.1.0 -django-auth-ldap==1.2.12 Django-Select2==6.3.1 djangorestframework==3.5.4 Pillow==3.3.1 psycopg2==2.7.5 djangorestframework-hstore==1.3 -pyldap==2.4.28 requests==2.16.5 urllib3==1.21.1 django_markdown2==0.3.0 diff --git a/spejstore/settings.py b/spejstore/settings.py index 426330a..2ce15f8 100644 --- a/spejstore/settings.py +++ b/spejstore/settings.py @@ -124,20 +124,11 @@ SELECT2_JS = 'js/select2.min.js' SELECT2_CSS = 'css/select2.min.css' SELECT2_I18N_PATH = '' -# LDAP configuration - -import ldap -from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType, LDAPGroupQuery - AUTHENTICATION_BACKENDS = ( - 'django_auth_ldap.backend.LDAPBackend', 'auth.backend.HSWawOAuth2', 'django.contrib.auth.backends.ModelBackend', ) -AUTH_LDAP_SERVER_URI = "ldaps://ldap.hackerspace.pl" -AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=People,dc=hackerspace,dc=pl" -AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True SOCIAL_AUTH_PIPELINE = ( 'social_core.pipeline.social_auth.social_details', 'social_core.pipeline.social_auth.social_uid', @@ -150,35 +141,6 @@ SOCIAL_AUTH_PIPELINE = ( 'auth.pipeline.staff_me_up', 'social_core.pipeline.social_auth.associate_by_email',) -member_ldap_query = ( - LDAPGroupQuery("cn=fatty,ou=Group,dc=hackerspace,dc=pl") | - LDAPGroupQuery("cn=starving,ou=Group,dc=hackerspace,dc=pl") | - LDAPGroupQuery("cn=potato,ou=Group,dc=hackerspace,dc=pl")) - -AUTH_LDAP_USER_FLAGS_BY_GROUP = { - "is_active": member_ldap_query, - "is_superuser": member_ldap_query, # "cn=staff,ou=Group,dc=hackerspace,dc=pl", - "is_staff": member_ldap_query, - } - -# Populate the Django user from the LDAP directory. -AUTH_LDAP_USER_ATTR_MAP = { - "first_name": "givenName", - "last_name": "sn", - "email": "mail" -} - -AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=Group,dc=hackerspace,dc=pl", - ldap.SCOPE_SUBTREE, "(objectClass=groupOfUniqueNames)" -) -AUTH_LDAP_GROUP_TYPE = GroupOfUniqueNamesType(name_attr="cn") - -import logging - -logger = logging.getLogger('django_auth_ldap') -logger.addHandler(logging.StreamHandler()) -logger.setLevel(logging.DEBUG) - # Internationalization # https://docs.djangoproject.com/en/1.10/topics/i18n/