question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with ldap_sync_users command (need ldap3 v2.2.3 module)

See original GitHub issue

Hello, Thanks for your clear documentation 😃 I try to make working your module for the first time but I have some issue.

My LDAP server is particular and need the last stable version (2.2.3) of ldap3 python module. You can see the issue corrected 2 days ago here : https://github.com/cannatag/ldap3/issues/334

When I try to import ldap users in django with your module, it’s not working.

You can see my try here :

gduale:~:$ . ./py361-test/bin/activate
(py361-test) gduale:~:$ pip install django-python3-ldap
Collecting django-python3-ldap
  Using cached django-python3-ldap-0.9.14.tar.gz
Collecting django>=1.8 (from django-python3-ldap)
  Using cached Django-1.11-py2.py3-none-any.whl
Collecting ldap3==2.2.0 (from django-python3-ldap)
  Using cached ldap3-2.2.0-py2.py3-none-any.whl
Collecting pytz (from django>=1.8->django-python3-ldap)
  Using cached pytz-2017.2-py2.py3-none-any.whl
Collecting pyasn1>=0.1.8 (from ldap3==2.2.0->django-python3-ldap)
  Using cached pyasn1-0.2.3-py2.py3-none-any.whl
Installing collected packages: pytz, django, pyasn1, ldap3, django-python3-ldap
  Running setup.py install for django-python3-ldap ... done
Successfully installed django-1.11 django-python3-ldap-0.9.14 ldap3-2.2.0 pyasn1-0.2.3 pytz-2017.2

Then I know that with ldap3 version 2.2.0 it will not work (I already try), so I install the latest version :

(py361-test) gduale:~:$ pip install --upgrade ldap3
Collecting ldap3
  Using cached ldap3-2.2.3-py2.py3-none-any.whl
Requirement already up-to-date: pyasn1>=0.1.8 in ./py361-test/lib/python3.6/site-packages (from ldap3)
Installing collected packages: ldap3
  Found existing installation: ldap3 2.2.0
    Uninstalling ldap3-2.2.0:
      Successfully uninstalled ldap3-2.2.0
Successfully installed ldap3-2.2.3

Then I try to sync the users, but it fails :

(py361-test) gduale:~/django-projects/test-c2i/c2i:$ python manage.py ldap_sync_users
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/home/gduale/make_python/python-3.6.1/lib/python3.6/contextlib.py", line 53, in inner
    return func(*args, **kwds)
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django_python3_ldap/management/commands/ldap_sync_users.py", line 21, in handle
    for user in connection.iter_users():
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django_python3_ldap/ldap.py", line 90, in <genexpr>
    if entry["type"] == "searchResEntry"
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django_python3_ldap/ldap.py", line 66, in _get_or_create_user
    **user_lookup
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django/db/models/query.py", line 475, in update_or_create
    lookup, params = self._extract_model_params(defaults, **kwargs)
  File "/home/gduale/py361-test/lib/python3.6/site-packages/django/db/models/query.py", line 531, in _extract_model_params
    "', '".join(sorted(invalid_params)),
django.core.exceptions.FieldError: Invalid field name(s) for model User: 'd', 'i', 'u'.

Do you know if is it possible to make working your module with the latest stable version of ldap3 please ? Thank you, Best regards.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
etianencommented, May 3, 2017

Excellent! LDAP is needlessly hard!

On Wed, 3 May 2017 at 10:53 tazou notifications@github.com wrote:

Hi, Sorry my fault… I change this parameter with : LDAP_AUTH_USER_LOOKUP_FIELDS = (“username”,)

And now the synchronization is working !

Thank a lot again for all your help !

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/etianen/django-python3-ldap/issues/78#issuecomment-298868106, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCD4O-gYzXWMiN1FFpAQtFAGjx3u1ks5r2E6UgaJpZM4NOJyO .

0reactions
etianencommented, May 6, 2017

Hey, no worries, and thanks for the gift card! Always a pleasure to help out a fellow coder!

On Sat, 6 May 2017 at 10:24 tazou notifications@github.com wrote:

Closed #78 https://github.com/etianen/django-python3-ldap/issues/78.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/etianen/django-python3-ldap/issues/78#event-1071518656, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCCvV7V-dX3E627lWzgtL_QdnADbnks5r3DwygaJpZM4NOJyO .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connection to LDAP server issue · Issue #334 · cannatag/ldap3
I have a connexion problem when I try to bind my LDAP server. ... Problem with ldap_sync_users command (need ldap3 v2.2.3 module) ...
Read more >
Tutorial: Introduction to ldap3 - Read the Docs
ldap3 usage is straightforward: you define a Server object and a Connection object. Then you issue commands to the connection. A server can...
Read more >
Welcome to ldap3's documentation — ldap3 2.9.1 ...
Welcome to ldap3's documentation¶. ldap3 is a pure Python LDAP 3 client library strictly conforming to RFC4510 and is released under the LGPL...
Read more >
CHANGELOG — ldap3 2.9.1 documentation
CHANGELOG¶ · fixed empty digestMd5.py file in 2.5.2 package · explicitly declare digest module md5 in util.ntlm (thanks adawalli) · change object passed...
Read more >
Installation and configuration — ldap3 2.9.1 documentation
You need the pip package (or another package manager that can download and install from pyPI) ... This library has only one dependence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found