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

Reformat

parent a106ee55
No related branches found
No related tags found
1 merge request!460Resolve "Permission bugs with editable list on person statistics page"
Pipeline #194861 failed
...@@ -86,7 +86,9 @@ ...@@ -86,7 +86,9 @@
<v-row class="mr-2"> <v-row class="mr-2">
<v-col cols="12" md="6" class="pa-0 d-flex"> <v-col cols="12" md="6" class="pa-0 d-flex">
<v-list-item-avatar <v-list-item-avatar
v-if="mode === MODE.PARTICIPATIONS && showCheckbox(item)" v-if="
mode === MODE.PARTICIPATIONS && showCheckbox(item)
"
> >
<v-item v-slot="{ active, toggle }" :value="item.id"> <v-item v-slot="{ active, toggle }" :value="item.id">
<v-simple-checkbox <v-simple-checkbox
......
...@@ -198,7 +198,8 @@ add_perm("alsijil.edit_documentation_rule", edit_documentation_predicate) ...@@ -198,7 +198,8 @@ add_perm("alsijil.edit_documentation_rule", edit_documentation_predicate)
add_perm("alsijil.delete_documentation_rule", edit_documentation_predicate) add_perm("alsijil.delete_documentation_rule", edit_documentation_predicate)
view_participation_status_for_documentation_predicate = has_person & ( view_participation_status_for_documentation_predicate = has_person & (
has_global_perm("alsijil.change_participationstatus") | can_view_participation_status_for_documentation has_global_perm("alsijil.change_participationstatus")
| can_view_participation_status_for_documentation
) )
add_perm( add_perm(
"alsijil.view_participation_status_for_documentation_rule", "alsijil.view_participation_status_for_documentation_rule",
...@@ -207,7 +208,10 @@ add_perm( ...@@ -207,7 +208,10 @@ add_perm(
edit_participation_status_for_documentation_with_time_range_predicate = ( edit_participation_status_for_documentation_with_time_range_predicate = (
has_person has_person
& (has_global_perm("alsijil.change_participationstatus") | can_edit_participation_status_for_documentation) & (
has_global_perm("alsijil.change_participationstatus")
| can_edit_participation_status_for_documentation
)
& is_in_allowed_time_range_for_participation_status & is_in_allowed_time_range_for_participation_status
) )
add_perm( add_perm(
...@@ -216,7 +220,8 @@ add_perm( ...@@ -216,7 +220,8 @@ add_perm(
) )
edit_participation_status_for_documentation_predicate = has_person & ( edit_participation_status_for_documentation_predicate = has_person & (
has_global_perm("alsijil.change_participationstatus") | can_edit_participation_status_for_documentation has_global_perm("alsijil.change_participationstatus")
| can_edit_participation_status_for_documentation
) )
add_perm( add_perm(
"alsijil.edit_participation_status_for_documentation_rule", "alsijil.edit_participation_status_for_documentation_rule",
......
...@@ -7,12 +7,10 @@ from reversion import create_revision, set_comment, set_user ...@@ -7,12 +7,10 @@ from reversion import create_revision, set_comment, set_user
from aleksis.apps.alsijil.util.predicates import ( from aleksis.apps.alsijil.util.predicates import (
can_edit_documentation, can_edit_documentation,
can_edit_participation_status_for_documentation,
is_in_allowed_time_range, is_in_allowed_time_range,
is_in_allowed_time_range_for_participation_status, is_in_allowed_time_range_for_participation_status,
) )
from aleksis.apps.alsijil.util.predicates import (
can_edit_participation_status_for_documentation as can_edit_participation_status_for_documentation_predicate,
)
from aleksis.apps.chronos.schema import LessonEventType from aleksis.apps.chronos.schema import LessonEventType
from aleksis.apps.cursus.models import Subject from aleksis.apps.cursus.models import Subject
from aleksis.apps.cursus.schema import CourseType, SubjectType from aleksis.apps.cursus.schema import CourseType, SubjectType
...@@ -56,8 +54,8 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp ...@@ -56,8 +54,8 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
future_notice = graphene.Boolean(required=False) future_notice = graphene.Boolean(required=False)
future_notice_participation_status = graphene.Boolean(required=False) future_notice_participation_status = graphene.Boolean(required=False)
can_edit_participation_status_for_documentation = graphene.Boolean(required=False) can_edit_participation_status = graphene.Boolean(required=False)
can_view_participation_status_for_documentation = graphene.Boolean(required=False) can_view_participation_status = graphene.Boolean(required=False)
old_id = graphene.ID(required=False) old_id = graphene.ID(required=False)
...@@ -96,12 +94,12 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp ...@@ -96,12 +94,12 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
return not is_in_allowed_time_range_for_participation_status(info.context.user, root) return not is_in_allowed_time_range_for_participation_status(info.context.user, root)
@staticmethod @staticmethod
def resolve_can_edit_participation_status_for_documentation(root: Documentation, info, **kwargs): def resolve_can_edit_participation_status(root: Documentation, info, **kwargs):
"""Shows whether the user can edit all participation statuses of the documentation""" """Shows whether the user can edit all participation statuses of the documentation"""
return can_edit_participation_status_for_documentation_predicate(info.context.user, root) return can_edit_participation_status_for_documentation(info.context.user, root)
@staticmethod @staticmethod
def resolve_can_view_participation_status_for_documentation(root: Documentation, info, **kwargs): def resolve_can_view_participation_status(root: Documentation, info, **kwargs):
"""Shows whether the user can view all participation statuses of the documentation""" """Shows whether the user can view all participation statuses of the documentation"""
return info.context.user.has_perm( return info.context.user.has_perm(
"alsijil.view_participation_status_for_documentation_rule", root "alsijil.view_participation_status_for_documentation_rule", root
......
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