Project

General

Profile

Bug #9162

Collision between LDAP attributs and User fields in get_users()

Added by Benjamin Dauvergne over 3 years ago. Updated over 1 year ago.

Status:
Fermé
Priority:
Haut
Category:
-
Target version:
Start date:
01 Dec 2015
Due date:
11 Dec 2015
% Done:

100%

Patch proposed:
No
Planning:
No

Description

get_users() does setattr(user, key, value) for each LDAP attribut (for a currently unknown reason, but certainly wrong), it must be removed. If an LDAP attribute is named ou for example (which is faily frequent) it produces a traceback since User.ou only accepts objects of type OrganizationalUnit.

Traceback (most recent call last):
  File "/usr/lib/authentic2/manage.py", line 21, in <module>
    execute_from_command_line(sys.argv[:1] + argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/dist-packages/authentic2/management/commands/sync-ldap-users.py", line 14, in handle
    for user in LDAPBackend.get_users():
  File "/usr/lib/python2.7/dist-packages/authentic2/backends/ldap_backend.py", line 948, in get_users
    setattr(user, name, value)
  File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 597, in __set__
    self.field.rel.to._meta.object_name,
ValueError: Cannot assign "[u'com', u'rh']": "LDAPUser.ou" must be a "OrganizationalUnit" instance.

Associated revisions

Revision a9e3a234 (diff)
Added by Benjamin Dauvergne over 3 years ago

ldap: do not copy LDAP attributes directly on the user object (fixes #9162)

History

#1 Updated by Benjamin Dauvergne over 3 years ago

  • Priority changed from Normal to Haut
  • Due date set to 11 Dec 2015

#2 Updated by Benjamin Dauvergne over 3 years ago

  • Target version set to 2.2.0

#3 Updated by Benjamin Dauvergne over 3 years ago

  • Status changed from Nouveau to Résolu (à déployer)
  • % Done changed from 0 to 100

#4 Updated by Benjamin Dauvergne over 3 years ago

  • Status changed from Résolu (à déployer) to Solution déployée

#5 Updated by Benjamin Dauvergne over 1 year ago

  • Status changed from Solution déployée to Fermé

Also available in: Atom PDF