Bug 44588 - U@S 4.1: Removing users causes displaying of error message
U@S 4.1: Removing users causes displaying of error message
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Wizards
UCS@school 4.1 R2
Other Linux
: P5 normal (vote)
: UCS@school 4.1 R2 v12
Assigned To: Florian Best
Daniel Tröder
:
Depends on: 43170 44537
Blocks:
  Show dependency treegraph
 
Reported: 2017-05-12 13:36 CEST by Sönke Schwardt-Krummrich
Modified: 2017-06-23 13:33 CEST (History)
6 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.091
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): API change, External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2017-05-12 13:36:46 CEST
Please also fix this issue for U@S 4.2.

+++ This bug was initially created as a clone of Bug #44537 +++

The changes caused a regression when removing non-school-overlapping users:

The UMC always shows "Konnte den Benutzer nicht aus der Schule entfernen." because remove_from_school() removes the user already (because she is only part of one school) and the newly added modify() call will therefore fail:

svn r76772
+»   »   »   if success:
+»   »   »   »   success = obj.modify(ldap_user_write)

So the user gets successfully removed but there will always be an error message that it failed.

+++ This bug was initially created as a clone of Bug #43170 +++

If a user which is located under schoolA and should be removed from schoolA a error message in UMC pops up "Failed to remove user from school.".

The logfile contains:
Student(name='elsabe', school='schoolA', dn='uid=elsabe,cn=schueler,cn=users,ou=schoolA,dc=school,dc=local') wants to move to its own DN!

The reason is that the UMC-frontend sends a request ala:
{$dn$: dn, school: 'schoolA'}
And the code does the following:
ucs-school-umc-wizards/umc/python/schoolwizards/__init__.py
104 »   »   if require_dn:
105 »   »   »   try:
106 »   »   »   »   obj = klass.from_dn(dn, obj_props.get('school'), lo)
107 »   »   »   except noObject:
108 »   »   »   »   raise UMC_Error(_('The %s %r does not exists or might have been removed in the meanwhile.') % (getattr(klass, 'type_name', klass.__name__), obj_props['name']))
109 »   »   »   for key, value in obj_props.iteritems():
110 »   »   »   »   if key in obj._attributes:
111 »   »   »   »   »   setattr(obj, key, value)

→ So it sets every value of the request i.e.
obj.school = 'schoolA'

In ucs-school-lib/python/models/user.py remove_from_school() then the following if-case is wrong:
398 »   »   if self.school == school:
399 »   »   »   if not self.change_school(self.schools[0], lo):
Comment 1 Florian Best univentionstaff 2017-05-16 17:20:17 CEST
ucs-school-umc-wizards (8.0.1-3):
r79380 | Bug #44588: fix removal of users

ucs-school-umc-wizards.yaml:
r79381 | YAML Bug #44588
Comment 2 Daniel Tröder univentionstaff 2017-05-18 16:31:40 CEST
Please clearly mark API changes in the future.

OK: code
OK: advisory
OK: manual test
OK: automatic test (QA adapted test-suite to API change and extended a test: r79430)
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2017-06-23 13:33:13 CEST
UCS@school 4.1 R2 v12 has been released.

http://docs.software-univention.de/changelog-ucsschool-4.1R2v12-de.html

If this error occurs again, please clone this bug.