Bug 52786 - Ignore disabled users when creating an exam
Ignore disabled users when creating an exam
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Exam mode
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v9
Assigned To: Toni Röhmeyer
Tobias Wenzel
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-12 12:25 CET by Toni Röhmeyer
Modified: 2023-05-26 15:39 CEST (History)
3 users (show)

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):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toni Röhmeyer univentionstaff 2021-02-12 12:25:15 CET
This bug is related to bug #52372


Enabling the UCRV "ucsschool/exam/user/disable" leads to deactivating the original users during an exam to prevent them from using other services (eg. Mail, Cloud...).
When the exam is finished, the disabled attribute is set False again which enables the user object.

Since it is not trivial to store the previous state of that attribute, an already disabled user which participates an exam gets activated as well when the exam is finished.

Usually it is not desired that disabled user can even participate an exam in the first place.
A fix should therefore implement the following features:

1. Users with the "disable" attribute set True, are ignored when an exam is created. They are not added to the exam.
2. Those ignored users should be logged correspondingly
Comment 1 Toni Röhmeyer univentionstaff 2021-02-15 11:03:25 CET
I added a patch on branch troehmey/bug52786 with

7ff06cc9d Bug #52786: ignore disabled users when creating exam

Disabled users now get ignored when an exam is created i.e. no exam-user account will be created and they won't be added to the exam group.

Cases of ignored user will be logged under
/var/log/univention/management-console-module-schoolexam-master.log
Comment 2 Daniel Tröder univentionstaff 2021-02-15 11:16:26 CET
Please add a paragraph about disabled users being excluded from exams to ucsschool-handbuch → school:exam:concept.
Comment 3 Toni Röhmeyer univentionstaff 2021-02-16 11:23:19 CET
Added doc paragraph with

c4694fba6 Bug #52786: added paragraph to exam doc

Spellcheck:
https://jenkins.knut.univention.de:8181/view/Doku/job/BuildDocBookBranchUCSSchool/50/

I also added a short note on the user disable functionality from bug #52372 to school:exam:concept.
Comment 4 Tobias Wenzel univentionstaff 2021-02-22 14:51:25 CET
QA → A couple of remarks, but already working → REOPEN

`tempfile.NamedTemporaryFile(dir="/tmp")`
→ Was this causing a problem? 


User ignored because disabled: 
→ Ignore disabled user {}


`self.finished(request.id, dict(success=True, userdn=userdn, examuserdn=""))`

Why not `self.finished(request.id, None)`? As far as I can see `userdn` is not used since the user is ignored. This way you could simply write `if not ires: continue`


Doc

z.B. Mail, Cloud... → z.B. Mail oder Cloud

Wie Benutzer aktiviert/deaktiviert werden können, wird im UCS-Handbuch<biblioref linkend="ucs-handbuch"/> beschrieben.

→ Where exactly? Add a ref to link to the section and move this to the end of the sentence before, like "(siehe ...)"


Functionalities

before fix:
exam-a.zombie is created during exam start → OK 

after fix:
exam-a.zombie is not created during exam start → OK
Comment 5 Daniel Tröder univentionstaff 2021-02-22 15:20:57 CET
(In reply to Tobias Wenzel from comment #4)
> `tempfile.NamedTemporaryFile(dir="/tmp")`
> → Was this causing a problem? 
This is because bandit is unhappy with hard coded temporary directories (https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html).
Comment 6 Toni Röhmeyer univentionstaff 2021-02-23 17:34:20 CET
I applied the suggested improvement from comment #4 with

e8e1dbafa Bug #52786: minor code improvements

However, I did not change the doc because:

- A UCS-manual section is nowhere else referenced in the ucs@school manual.
- I think the separate sentence for the reference improves the understanding of WHY it is worth to take a look into the UCS manual. Otherwise, the reader may not know what to search for.
Comment 7 Tobias Wenzel univentionstaff 2021-03-04 12:59:35 CET
QA → All OK → REOPEN for Merge, changelog & yaml, build and yaml version update

[troehmey/bug52786] e8e1dbafa Bug #52786: minor code improvements
→ please squash this commit to 7ff06cc9d

[troehmey/bug52786] c4694fba6 Bug #52786: added paragraph to exam doc
[troehmey/bug52786] 7ff06cc9d Bug #52786: ignore disabled users when creating exam


Doc (non-)changes → OK
Code Changes → OK
Functionality → OK
Comment 8 Toni Röhmeyer univentionstaff 2021-03-06 12:34:41 CET
Merged to 4.4 with

7e5114872 Bug #52786: added yaml
28c0ec8ac Bug #52786: added changelog entry
084e04aea Bug #52786: Merge branch 'troehmey/bug52786' into 4.4
28c96ed13 Bug #52786: ignore disabled users when creating exam

successful build:

Package: ucs-school-umc-exam
Version: 9.0.1-49A~4.4.0.202103061221
Branch: ucs_4.4-0
Scope: ucs-school-4.4
Comment 9 Tobias Wenzel univentionstaff 2021-03-09 09:06:22 CET
QA → All OK → Verfiy

Changelog → OK
YAML → OK
Merge → OK
Jenkins → Green
Comment 10 Tobias Wenzel univentionstaff 2021-03-24 14:12:46 CET
UCS@school 4.4 v9 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.4v9-de.html

If this error occurs again, please clone this bug.