Skip to content
Snippets Groups Projects
Verified Commit 24f5150d authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix rules in person overview for the lesson documentations and the personal notes editing tab

(cherry picked from commit e11bc504)
parent ce19834e
No related branches found
No related tags found
1 merge request!216Prepare release 2.0rc4
......@@ -6,6 +6,15 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Fixed
~~~~~
* The lesson documentations tab was displayed on overviews for persons who are not teachers.
* Teachers weren't able to edit personal notes of their students in the person overview.
`2.0rc3`_ - 2021-07-20
----------------------
......
......@@ -189,7 +189,7 @@ add_perm(
)
# Edit person overview personal notes
edit_person_overview_personal_notes_predicate = view_person_overview_personal_notes_predicate & (
edit_person_overview_personal_notes_predicate = view_person_overview_predicate & (
~is_current_person
| has_global_perm("alsijil.edit_personalnote")
| has_person_group_object_perm("core.edit_personalnote_group")
......
......@@ -876,7 +876,9 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp
context["excuse_types"] = ExcuseType.objects.all()
form = PersonOverviewForm(request, request.POST or None, queryset=allowed_personal_notes)
if request.method == "POST":
if request.method == "POST" and request.user.has_perm(
"alsijil.edit_person_overview_personalnote_rule", person
):
if form.is_valid():
with reversion.create_revision():
reversion.set_user(request.user)
......@@ -957,7 +959,7 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp
filter_dict["person"] = person
context["filter_form"] = filter_form
if request.user.person.is_teacher:
if person.is_teacher:
register_objects = generate_list_of_all_register_objects(filter_dict)
table = RegisterObjectTable(register_objects)
items_per_page = request.user.person.preferences[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment