Univention Bugzilla – Bug 56937
Exam mode throws traceback if local Windows user is logged into a computer
Last modified: 2024-02-05 15:59:16 CET
Created attachment 11167 [details] workaround.patch If a local Windows user (not a domain user) is logged into any machine within the computerroom, the exam mode throws a traceback and ends without cleaning up. An Administrator has to clean up the exam manually before a teacher can retry the exam. This caused significant pain in a customer environment, because the exam was still displayed as "running" after the traceback occured and a teacher didn't expect the problem to be severe until after the exam. The issue is, that each username on each machine is parsed in the room_management.py code before starting the exam. It is there assumed, that the name follows the scheme DOMAIN\\username. The code tries to extract the username from this string, but raises an error if this scheme doesn't mach. In case a local user is logged into a machine, their name is just "username" without any domain path in front. We were not sure why this is so strictly checked. If the check can be removed / relaxed, that's great. But if it is necessary, the state after the error should be cleaned up completely so that a new exam can be started. This Traceback is generated: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 259, in _run result = self._function(*args, **kwargs) # type: Union[BaseException, _T] File "/usr/lib/python3/dist-packages/univention/management/console/modules/schoolexam/__init__.py", line 779, in _thread customRule=request.options.get("customRule"), File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/__init__.py", line 208, in _decorated return func(self, request, *args, **kwargs) File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/__init__.py", line 945, in _settings_set self.reset_smb_connections() File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/__init__.py", line 960, in reset_smb_connections veyon_users = [x.lower() for x in self._computerroom.users if x] File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/room_management.py", line 251, in users for x in self.values() File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/room_management.py", line 252, in <listcomp> if x.user.current and x.connected() File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/room_management.py", line 92, in __getitem__ self._read_user(user) File "/usr/lib/python3/dist-packages/ucsschool/lib/school_umc_ldap_connection.py", line 156, in wrapper_func return func(*args, **kwargs) File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/room_management.py", line 106, in _read_user username = self.validate_userstr(userstr) File "/usr/lib/python3/dist-packages/univention/management/console/modules/computerroom/room_management.py", line 98, in validate_userstr raise AttributeError("invalid key {!r}".format(userstr)) AttributeError: invalid key 'lokalerAccountName' We hot patched this in the customer environment, so that they can write exams unhindered in the new year. While this patch is certainly not a correct and clean solution, it enabled the customer to write exams again, even with local users logged into the machines.
Command from the partner to this issue: In my opinion, in this case you should also in this case, but ask the teacher to fix the problem (local user login) This is probably easier to implement ;)