Univention Bugzilla – Bug 42432
schoolwizards are broken for users without ucsschoolSchool
Last modified: 2016-10-25 15:58:59 CEST
The school wizards can't be used with users which doesn't have the ucsschoolSchool attribute set. It seems the attribute is not set by the import script leading to such users. Command to import users was: /usr/share/ucs-school-import/scripts/ucs-school-import users.csv users.csv: A Anton12 Lange Anton test test-1B Anton12@test2.intranet 0 1 0 HTTP request which causes the traceback: curl 'http://Administrator:univention@10.200.36.100/univention-management-console/command/schoolwizards/users/put' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary '{"options":[{"object":{"school":"test","type":"student","firstname":"Anton","lastname":"Lange","name":"anton12","school_classes":{"test":["4B"]},"email":"anton12@test2.intranet","password":"","$dn$":"uid=anton12,cn=schueler,cn=users,ou=test,dc=test2,dc=intranet"},"options":null}],"flavor":"schoolwizards/users"}' Current unrelease packages were used: python-ucs-school 9.0.23-6.261.201609150827 Execution of command 'schoolwizards/users/put schoolwizards/users' has failed: Traceback (most recent call last): File "%PY2.7%/univention/management/console/base.py", line 283, in execute function(self, request) File "%PY2.7%/univention/management/console/modules/schoolwizards/__init__.py", line 112, in _decorated ret = func(self, request, *a, **kw) File "%PY2.7%/ucsschool/lib/schoolldap.py", line 142, in wrapper_func return func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/schoolwizards/__init__.py", line 204, in _modify_obj obj.modify(ldap_user_write, validate=False) File "%PY2.7%/ucsschool/lib/models/base.py", line 471, in modify success = self.modify_without_hooks(lo, validate, move_if_necessary) File "%PY2.7%/ucsschool/lib/models/base.py", line 494, in modify_without_hooks self.do_modify(udm_obj, lo) File "%PY2.7%/ucsschool/lib/models/user.py", line 259, in do_modify mandatory_groups = self.groups_used(lo) File "%PY2.7%/ucsschool/lib/models/user.py", line 458, in groups_used group_dns = self.get_specific_groups(lo) File "%PY2.7%/ucsschool/lib/models/user.py", line 582, in get_specific_groups groups = super(Student, self).get_specific_groups(lo) File "%PY2.7%/ucsschool/lib/models/user.py", line 361, in get_specific_groups groups = self.get_domain_users_groups() File "%PY2.7%/ucsschool/lib/models/user.py", line 443, in get_domain_users_groups return [self.get_group_dn('Domain Users %s' % school, school) for school in self.schools] TypeError: 'NoneType' object is not iterable
(In reply to Florian Best from comment #0) > Command to import users was: > /usr/share/ucs-school-import/scripts/ucs-school-import users.csv I think the old-legacy user import is not supported. "import_user" is the script that is in the documentation, and that is the new-legacy user import.
*** Bug 42441 has been marked as a duplicate of this bug. ***
I already got part of the patch. But this is not yet finished as it prevents the traceback but the values aren't stored as no changes are detected somehow. diff --git a/ucs-school-lib/python/models/base.py b/ucs-school-lib/python/models/base.py index de3be60..9b26276 100644 --- a/ucs-school-lib/python/models/base.py +++ b/ucs-school-lib/python/models/base.py @@ -249,8 +249,8 @@ class UCSSchoolHelperAbstractClass(object): self._udm_obj = None kwargs['name'] = name kwargs['school'] = school - for key in self._attributes: - setattr(self, key, kwargs.get(key)) + for key, attr in self._attributes.items(): + setattr(self, key, kwargs.get(key, [] if attr.value_list else ({} if attr.value_dict else None))) self.__position = None self.old_dn = None self.old_dn = self.dn
(In reply to Florian Best from comment #3) > I already got part of the patch. But this is not yet finished as it prevents > the traceback but the values aren't stored as no changes are detected > somehow. "no changes" → no changes which schools the user belongs to.
An other traceback according to this issue happened, caused by changing the password via school-administration-module → users → select an user → type a new password. Saving the changes, the following traceback is shown up: Die Ausführung des Kommandos schoolwizards/users/put schoolwizards/users ist fehlgeschlagen: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/management/console/base.py", line 283, in execute function(self, request) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolwizards/__init__.py", line 112, in _decorated ret = func(self, request, *a, **kw) File "/usr/lib/pymodules/python2.7/ucsschool/lib/schoolldap.py", line 140, in wrapper_func return func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolwizards/__init__.py", line 204, in _modify_obj obj.modify(ldap_user_write, validate=False) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 471, in modify success = self.modify_without_hooks(lo, validate, move_if_necessary) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 494, in modify_without_hooks self.do_modify(udm_obj, lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/user.py", line 273, in do_modify classes = self.school_classes[school_group.school] TypeError: 'NoneType' object has no attribute '__getitem__'
(In reply to Christina Scheinig from comment #5) > An other traceback according to this issue happened, caused by changing the > password via school-administration-module → users → select an user → type a > new password. Saving the changes, the following traceback is shown up: > That is Bug #42365
*** This bug has been marked as a duplicate of bug 42441 ***
UCS@school 4.1 R2 v6 has been released. http://docs.software-univention.de/changelog-ucsschool-4.1R2v6-de.html If this error occurs again, please clone this bug.