Skip to content
Snippets Groups Projects
Commit d5de6b13 authored by Tom Teichler's avatar Tom Teichler :beers: Committed by root
Browse files

Add rules

parent 90aa5833
No related branches found
No related tags found
1 merge request!55WIP: Resolve "Migrate to AlekSIS app"
Pipeline #3822 failed
......@@ -31,3 +31,10 @@ def is_own_voucher(user: User, voucher: Voucher) -> bool:
"""Predicate which checks if the voucher belongs to the user."""
return voucher.person == user.person
@predicate
def is_own_registration(user: User, registration: Registration) -> bool:
"""Predicate which checks if the registration belongs to the user.""""
return registration.person == user.person
......@@ -11,11 +11,10 @@ from aleksis.core.util.predicates import (
from .models import EventRegistration, FeedbackAspect, TeckidsMember, TeckidsEvent, Voucher
from .predicates import (
is_own_pgp_key,
is_own_ssh_key,
is_own_voucher,
see_group_by_grouptype,
see_owned_groups_members,
is_own_registration,
)
# View vouchers
......@@ -91,6 +90,7 @@ add_perm("ticdesk.view_registrations", view_registrations_predicate)
# Manage registrations
manage_registrations_predicate = has_person & (
has_global_perm("ticdesk.manage_registrations")
| is_own_registration
| has_any_object("ticdesk.manage_registrations", EventRegistration)
)
add_perm("ticdesk.manage_registrations", manage_registrations_predicate)
......
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