Bug 44537 - (4.2) Removing users causes displaying of error message
(4.2) Removing users causes displaying of error message
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Wizards
UCS@school 4.2
Other Linux
: P5 normal (vote)
: UCS@school 4.2 v2
Assigned To: Florian Best
Daniel Tröder
:
Depends on: 43170
Blocks: 44588 45018 45344
  Show dependency treegraph
 
Reported: 2017-05-04 17:33 CEST by Florian Best
Modified: 2017-09-07 16:49 CEST (History)
5 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 Florian Best univentionstaff 2017-05-04 17:33:50 CEST
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 16:43:34 CEST
Hmm, not so easy to fix.
The changes also depend on Bug #41910 (svn r76682).
the remove_from_school() function since then does sometimes a modification and sometimes not, depending on the primary/secondary school.
Comment 2 Florian Best univentionstaff 2017-05-16 17:20:45 CEST
ucs-school-umc-wizards (9.0.4-5):
r79377 | Bug #44537: fix removal of users

ucs-school-umc-wizards.yaml:
r79378 | YAML Bug #44537
Comment 3 Daniel Tröder univentionstaff 2017-05-17 12:27:18 CEST
When I remove a student that is in 1 school in the UMC, I get this error window:
--------------------------------------------------
1 error(s) occurred:
0
object
remove_from_school: Argument required
--------------------------------------------------

Nothing is logged to management-console-module-schoolwizards.log, but in
management-console-web-server.log there is:
--------------------------------------------------
17.05.17 12:20:09.914  MAIN        ( PROCESS ) : CPCommand (10.205.1.238:32862) response status code: 422
17.05.17 12:20:09.914  MAIN        ( PROCESS ) : CPCommand (10.205.1.238:32862) response message: 1 error(s) occurred
17.05.17 12:20:09.914  MAIN        ( PROCESS ) : CPCommand (10.205.1.238:32862) response result: {'0': {'object': {'remove_from_school': 'Argument required'}}}
--------------------------------------------------
Comment 4 Florian Best univentionstaff 2017-05-17 13:52:10 CEST
It's only a caching issue in UCS 4.2. After 1 day the cache is reset. Therefore not a real problem. The UCS 4.1 bug is not affected.
Comment 5 Daniel Tröder univentionstaff 2017-05-18 15:46:25 CEST
OK: manual test
OK: automated test

r79426: extended test to check removal of single, primary and secondary schools from User
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2017-06-23 13:32:24 CEST
UCS@school 4.2 v2 has been released.

http://docs.software-univention.de/changelog-ucsschool-4.2v2-de.html

If this error occurs again, please clone this bug.