Univention Bugzilla – Bug 45717
all selectable roles are shown even if the permissions deny the selection
Last modified: 2017-12-21 12:23:04 CET
All types of roles are shown for the import. Instead only the allowed roles for the selected school should be shown.
I implemented the parts of the UMC module and used a dummy client library implementation. @Daniel, please implement the django backend. ucs-school-umc-import (0.0.1-15) d67c4aeae70d | Bug #45717: use client library to return dynamic role selection ucs-school-import (15.0.3-4) 4d14c23f7c11 | Bug #45717: add dummy backend implementation ucs-school-umc-import.yaml f4b15e19c4a9 | YAML Bug #45717 ucs-school-import.yaml f4b15e19c4a9 | YAML Bug #45717
[4.2 b623f43d] Bug #45717: dynamic role selection backend implementation The Python client API now has a resources "roles" with a method "list": import logging from ucsschool.http_api.client import Client client = Client('teacher11', 'univention') client = Client('teacher11', 'univention', log_level=logging.DEBUG) 2017-11-17 01:11:10 DEBUG client.__init__:321 Registering resources and methods: 2017-11-17 01:11:10 DEBUG client.__init__:328 school: get, latest, list 2017-11-17 01:11:10 DEBUG client.__init__:328 roles: list 2017-11-17 01:11:10 DEBUG client.__init__:328 userimportjob: create, get, latest, list client.roles.list('SchuleEins') → [Role(name='student', displayName='Student'), Role(name='teacher', displayName='Teacher'), Role(name='staff', displayName='Staff')] This will list 3 choices in the drop-down. There is a UI bug, when only 1 role is returned: client.roles.list('SchuleZwei') → [Role(name='student', displayName='Student')] [dict(id=role.name, label=role.displayName) for role in client.roles.list('SchuleZwei')] → [{'id': 'student', 'label': 'Student'}] When 'SchuleZwei' is chosen, the type-drop-down vanishes. Good: Schools with no permissions are not listed.
(In reply to Daniel Tröder from comment #2) > [4.2 b623f43d] Bug #45717: dynamic role selection backend implementation > > The Python client API now has a resources "roles" with a method "list": > > import logging > from ucsschool.http_api.client import Client > > client = Client('teacher11', 'univention') > client = Client('teacher11', 'univention', log_level=logging.DEBUG) > 2017-11-17 01:11:10 DEBUG client.__init__:321 Registering resources and > methods: > 2017-11-17 01:11:10 DEBUG client.__init__:328 school: get, latest, list > 2017-11-17 01:11:10 DEBUG client.__init__:328 roles: list > 2017-11-17 01:11:10 DEBUG client.__init__:328 userimportjob: create, > get, latest, list > > client.roles.list('SchuleEins') > → [Role(name='student', displayName='Student'), > Role(name='teacher', displayName='Teacher'), > Role(name='staff', displayName='Staff')] > > This will list 3 choices in the drop-down. The changes are done directly in the client. But they should be done on the server! Otherwise it is not possible to have the server on a different system than the client. The logic also belongs into the server. > There is a UI bug, when only 1 role is returned: > > client.roles.list('SchuleZwei') > → [Role(name='student', displayName='Student')] > > [dict(id=role.name, label=role.displayName) for role in > client.roles.list('SchuleZwei')] > → [{'id': 'student', 'label': 'Student'}] > > When 'SchuleZwei' is chosen, the type-drop-down vanishes. > > Good: Schools with no permissions are not listed. Fixed in: ucs-school-umc-import (0.0.1-17) f0f0bc6d9d1c | Bug #45717: don't hide role selection if only one role is possible
(In reply to Florian Best from comment #3) > (In reply to Daniel Tröder from comment #2) > > The Python client API now has a resources "roles" with a method "list": > The changes are done directly in the client. But they should be done on the > server! Otherwise it is not possible to have the server on a different > system than the client. The logic also belongs into the server. That'd not strictly correct. The client is designated to run on a UCS master. All groups are accessible there. It was not decided to create a new resource in the HTTP API. While I personally think we should have a couple more of them I cannot decide it. We should discuss this on the next meeting.
We decided - for the MVP - to let the client library handle the request for import permissions. For the software to leave the beta/MVP phase Bug #45749 must be implemented.
OK: the dropdown menu only contains the permitted roles (depending on the school) OK: error message if no permissions for any group exists
UCS@school 4.2 v6 has been released. http://docs.software-univention.de/changelog-ucsschool-4.2v6-de.html If this error occurs again, please clone this bug.