Teacher access right fallback solution#269
Teacher access right fallback solution#269JonasJoKuJonas merged 3 commits intoJonasJoKuJonas:mainfrom
Conversation
…r list in case the user does not have access rights to the full teacher list. In the case of missing access rights, the teacher list is created from the info that is provided in the lessons (id and a short 'name' of the teacher). This info is then used to create an internal teacher list, that is used by the teachers() method. Since the teacher list is only created from the latest data, it will be updated every time the user is receiving a new timetable with previously unknown teachers.
|
Thanks for contribution! But the sense of this change is not really clear :) |
|
Without this change, I cannot see any information on teachers of my lessons in my own timetable, so I also cannot see when the teacher is changing. |
|
Should btw also fix issue #180, as I had the same problem, and it is gone now with this change. |
|
Ah, I understand.. Have you found out why you havent this permissions? |
|
Only employees of the school have the permission to get the Full teacher List. Students will only get the short name in their timetable. |
There was a problem hiding this comment.
Pull request overview
Adds a fallback path for teacher lookup when the WebUntis server forbids direct teacher-list access, aiming to keep teacher-related features working by building a teacher list from timetable data.
Changes:
- Extend
ExtendedSessionwith a forbidden-teachers fallback that builds/updates an internal teacher mapping fromgetTimetable. - Update timetable calls to keep the fallback teacher mapping in sync with newly seen teachers.
- Tighten
compact_listmerging so lessons with different rooms/teachers are no longer compacted together; improve debug logging around lesson JSON creation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
custom_components/webuntis/utils/web_untis_extended.py |
Adds teacher fallback mapping logic and hooks it into timetable retrieval / teachers() behavior. |
custom_components/webuntis/utils/utils.py |
Prevents compaction across items that differ by rooms/teachers. |
custom_components/webuntis/__init__.py |
Adds debug logs for failures when populating lesson JSON fields; minor formatting change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I just committed some changes based on the Copilot review results. |
|
@JonasJoKuJonas , could you have another look? |
|
@Philip0606 Change looks solid for me. Altough I don‘t really get why you dont have permissions to fetch teachers. That doesnt make sense in my opinion :D |
|
@mrtncode, without the teacher list, the Teachers() method fails for the session, so It will not get any information about changes in teachers (e.g. substitution teacher) in the timetable at all, as the python module is then just skipping all info (it could still just show the numeric id, but it won't.... |
|
@Philip0606 Ah great! Then I understood it right. |
…ack_list" This reverts commit 91637d3, reversing changes made to fff1c3b. Pull request #269 introduced a bug that occurs when the timetable source is set to something other than the personal timetable and the account lacks teacher access rights. Further testing showed that `timetable_source` is interpreted differently in `my_timetable` and `timetable_extended`. The method `_update_teacher_mapping` does not account for these differences and fails when calling `getTimetable`. Until a proper fix is implemented and tested across different timetable sources for the “Teacher access right fallback solution,” these changes will be reverted to prevent the bug and keep the integration usable for affected users in the current version.
…_teacher_fallback_list" This reverts commit 91637d3, reversing changes made to fff1c3b. Pull request JonasJoKuJonas#269 introduced a bug that occurs when the timetable source is set to something other than the personal timetable and the account lacks teacher access rights. Further testing showed that `timetable_source` is interpreted differently in `my_timetable` and `timetable_extended`. The method `_update_teacher_mapping` does not account for these differences and fails when calling `getTimetable`. Until a proper fix is implemented and tested across different timetable sources for the “Teacher access right fallback solution,” these changes will be reverted to prevent the bug and keep the integration usable for affected users in the current version.
Extend the webuntis session with a fallback solution to read a teacher list in case the user does not have access rights to the full teacher list.
In the case of missing access rights, the teacher list is created from the info that is provided in the lessons (id and a short 'name' of the teacher). This info is then used to create an internal teacher list, that is used by the teachers() method.
Since the teacher list is only created from the latest data, it will be updated every time the user is receiving a new timetable with previously unknown teachers.
To make it work in an existing configuration, the user has to delete the 'teachers' entry from his webuntis integration configuration (Backend->Exclude from requests) after updating the integration.