[Python-modules-commits] [django-python3-ldap] 01/01: New upstream version 0.11.0
Michael Fladischer
fladi at moszumanska.debian.org
Sun Aug 20 13:30:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch upstream
in repository django-python3-ldap.
commit 60414a16d2eb2fe07df7aeffbc87b26fdf0cb265
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Sun Aug 20 15:10:14 2017 +0200
New upstream version 0.11.0
---
CHANGELOG.rst | 7 +++++++
PKG-INFO | 2 +-
django_python3_ldap.egg-info/PKG-INFO | 2 +-
django_python3_ldap.egg-info/requires.txt | 3 ++-
django_python3_ldap/__init__.py | 2 +-
django_python3_ldap/ldap.py | 4 +++-
django_python3_ldap/management/commands/ldap_sync_users.py | 11 +++++++----
setup.py | 3 ++-
8 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index bb9fca5..2aab52f 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,13 @@
django-python3-ldap changelog
=============================
+0.11.0
+------
+
+- Support added for User models with a ``USERNAME_FIELD`` other than ``username`` (@audiolion).
+- Fixed bug with `pyasn1` version (@etianen).
+
+
0.10.0
------
diff --git a/PKG-INFO b/PKG-INFO
index ccffb8f..2080b34 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-python3-ldap
-Version: 0.10.0
+Version: 0.11.0
Summary: Django LDAP user authentication backend for Python 3.
Home-page: https://github.com/etianen/django-python3-ldap
Author: Dave Hall
diff --git a/django_python3_ldap.egg-info/PKG-INFO b/django_python3_ldap.egg-info/PKG-INFO
index ccffb8f..2080b34 100644
--- a/django_python3_ldap.egg-info/PKG-INFO
+++ b/django_python3_ldap.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-python3-ldap
-Version: 0.10.0
+Version: 0.11.0
Summary: Django LDAP user authentication backend for Python 3.
Home-page: https://github.com/etianen/django-python3-ldap
Author: Dave Hall
diff --git a/django_python3_ldap.egg-info/requires.txt b/django_python3_ldap.egg-info/requires.txt
index 698f788..8ce4cf1 100644
--- a/django_python3_ldap.egg-info/requires.txt
+++ b/django_python3_ldap.egg-info/requires.txt
@@ -1,2 +1,3 @@
django>=1.8
-ldap3==2.2.3
+ldap3==2.3
+pyasn1==0.3.2
diff --git a/django_python3_ldap/__init__.py b/django_python3_ldap/__init__.py
index 73f0bcc..c34f6e8 100644
--- a/django_python3_ldap/__init__.py
+++ b/django_python3_ldap/__init__.py
@@ -3,4 +3,4 @@ Django LDAP user authentication backend for Python 3.
"""
-__version__ = (0, 10, 0)
+__version__ = (0, 11, 0)
diff --git a/django_python3_ldap/ldap.py b/django_python3_ldap/ldap.py
index 1bdc0ed..6f49ae4 100644
--- a/django_python3_ldap/ldap.py
+++ b/django_python3_ldap/ldap.py
@@ -149,6 +149,7 @@ def connection(**kwargs):
ldap3.Server(
settings.LDAP_AUTH_URL,
allowed_referral_hosts=[("*", True)],
+ get_info=ldap3.NONE,
),
user=username,
password=password,
@@ -167,9 +168,10 @@ def connection(**kwargs):
settings.LDAP_AUTH_CONNECTION_PASSWORD != password
)
):
+ User = get_user_model()
try:
c.rebind(
- user=format_username({"username": settings.LDAP_AUTH_CONNECTION_USERNAME}),
+ user=format_username({User.USERNAME_FIELD: settings.LDAP_AUTH_CONNECTION_USERNAME}),
password=settings.LDAP_AUTH_CONNECTION_PASSWORD,
)
except LDAPException as ex:
diff --git a/django_python3_ldap/management/commands/ldap_sync_users.py b/django_python3_ldap/management/commands/ldap_sync_users.py
index ad725df..d184c3a 100644
--- a/django_python3_ldap/management/commands/ldap_sync_users.py
+++ b/django_python3_ldap/management/commands/ldap_sync_users.py
@@ -1,3 +1,4 @@
+from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
@@ -12,10 +13,12 @@ class Command(BaseCommand):
@transaction.atomic()
def handle(self, *args, **kwargs):
verbosity = int(kwargs.get("verbosity", 1))
- with ldap.connection(
- username=settings.LDAP_AUTH_CONNECTION_USERNAME,
- password=settings.LDAP_AUTH_CONNECTION_PASSWORD,
- ) as connection:
+ User = get_user_model()
+ auth_kwargs = {
+ User.USERNAME_FIELD: settings.LDAP_AUTH_CONNECTION_USERNAME,
+ 'password': settings.LDAP_AUTH_CONNECTION_PASSWORD
+ }
+ with ldap.connection(**auth_kwargs) as connection:
if connection is None:
raise CommandError("Could not connect to LDAP server")
for user in connection.iter_users():
diff --git a/setup.py b/setup.py
index a9f69a4..ecd1a7a 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,8 @@ setup(
packages=find_packages(),
install_requires=[
"django>=1.8",
- "ldap3==2.2.3",
+ "ldap3==2.3",
+ "pyasn1==0.3.2",
],
classifiers=[
"Development Status :: 4 - Beta",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-python3-ldap.git
More information about the Python-modules-commits
mailing list