Skip to content
Snippets Groups Projects
Commit de1e5605 authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Add rule for fetching extra marks

parent 3f982d23
No related branches found
No related tags found
1 merge request!362Resolve "Add personal note management dialog in course book"
......@@ -283,6 +283,10 @@ add_perm("alsijil.delete_excusetype_rule", delete_excusetype_predicate)
view_extramarks_predicate = has_person & has_global_perm("alsijil.view_extramark")
add_perm("alsijil.view_extramarks_rule", view_extramarks_predicate)
# Fetch all extra marks
fetch_extramarks_predicate = has_person
add_perm("alsijil.fetch_extramarks_rule", fetch_extramarks_predicate)
# Add extra mark
add_extramark_predicate = view_extramarks_predicate & has_global_perm("alsijil.add_extramark")
add_perm("alsijil.add_extramark_rule", add_extramark_predicate)
......
......@@ -27,8 +27,8 @@ class ExtraMarkType(
@classmethod
def get_queryset(cls, queryset, info):
if has_person(info.context.user):
return get_objects_for_user(info.context.user, "alsijil.view_extramark", queryset)
if info.context.user.has_perm("alsijil.fetch_extramarks_rule"):
return queryset
raise PermissionDenied()
......
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