Bug 45717 - all selectable roles are shown even if the permissions deny the selection
Summary: all selectable roles are shown even if the permissions deny the selection
Status: CLOSED FIXED
Alias: None
Product: UCS@school
Classification: Unclassified
Component: UMC - User Import UI
Version: UCS@school 4.2
Hardware: Other Linux
: P5 normal
Target Milestone: UCS@school 4.2 (HTTP-API-MVP)
Assignee: Daniel Tröder
QA Contact: Florian Best
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-15 13:48 CET by Florian Best
Modified: 2017-12-21 12:23 CET (History)
0 users

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
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-11-15 13:48:21 CET
All types of roles are shown for the import. Instead only the allowed roles for the selected school should be shown.
Comment 1 Florian Best univentionstaff 2017-11-15 14:01:34 CET
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
Comment 2 Daniel Tröder univentionstaff 2017-11-17 15:58:42 CET
[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.
Comment 3 Florian Best univentionstaff 2017-11-17 16:09:48 CET
(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
Comment 4 Daniel Tröder univentionstaff 2017-11-17 16:50:53 CET
(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.
Comment 5 Daniel Tröder univentionstaff 2017-11-20 12:42:50 CET
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.
Comment 6 Florian Best univentionstaff 2017-11-22 12:35:42 CET
OK: the dropdown menu only contains the permitted roles (depending on the school)
OK: error message if no permissions for any group exists
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2017-12-21 12:23:04 CET
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.