Skip to content
Snippets Groups Projects
Commit 727939e9 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add missing permissions for registration states

parent c593f63a
No related branches found
No related tags found
1 merge request!15Resolve "Permissions by group owners"
Pipeline #59155 failed
......@@ -54,6 +54,12 @@ rules.add_perm("paweljong.create_vouchers_rule", create_vouchers_predicate)
## Events
# View events
view_events_predicate = has_person & (
has_global_perm("paweljong.view_event") | has_any_object("paweljong.view_event", Event)
)
rules.add_perm("paweljong.view_events_rule", view_events_predicate)
# Edit event
change_event_predicate = has_person & (
has_global_perm("paweljong.change_event") | has_object_perm("paweljong.change_event")
......@@ -61,7 +67,7 @@ change_event_predicate = has_person & (
rules.add_perm("paweljong.change_event_rule", change_event_predicate)
# View event
view_event_predicate = (is_event_published)
view_event_predicate = (is_event_published | (has_person & is_organiser) | has_object_perm("paweljong.view_event"))
rules.add_perm("paweljong.view_event_rule", view_event_predicate)
# Delete event
......@@ -177,13 +183,48 @@ create_info_mailings_predicate = has_person & (
)
rules.add_perm("paweljong.create_info_mailings_rule", create_info_mailings_predicate)
## Registration states
# View registration_states
view_registration_states_predicate = has_person & (
has_global_perm("paweljong.view_registration_state")
| has_any_object("paweljong.view_registration_state", Terms)
)
rules.add_perm("paweljong.view_registration_states_rule", view_registration_states_predicate)
# View registration_state
view_registration_state_predicate = has_person & (
has_global_perm("paweljong.view_registration_state") | has_object_perm("paweljong.view_registration_state")
)
rules.add_perm("paweljong.view_registration_state_rule", view_registration_state_predicate)
# Delete registration_state
delete_registration_state_predicate = has_person & (
has_global_perm("paweljong.delete_eventregistration_state")
| has_object_perm("paweljong.delete_eventregistration_state")
)
rules.add_perm("paweljong.delete_registration_state_rule", delete_registration_state_predicate)
# Change registration_state
change_registration_state_predicate = has_person & (
has_global_perm("paweljong.change_eventregistration_state")
| has_object_perm("paweljong.change_eventregistration_state")
)
rules.add_perm("paweljong.change_registration_state_rule", change_registration_state_predicate)
# Create registration_states
create_registration_states_predicate = has_person & (
has_global_perm("paweljong.create_registration_state") | has_any_object("paweljong.create_registration_state", Event)
)
rules.add_perm("paweljong.create_registration_states_rule", create_registration_states_predicate)
# View menu
can_view_menu_predicate = has_person & (
has_any_object("paweljong.manage_registrations_rule", EventRegistration)
| has_any_object("paweljong.view_info_mailing", InfoMailing)
| has_any_object("paweljong.view_terms", Terms)
| has_any_object("paweljong.view_voucher", Voucher)
| has_any_object("paweljong.view_event", Event)
| has_any_object("paweljong.view_registrationstate", RegistrationState)
view_registrations_predicate
| view_info_mailings_predicate
| view_terms_predicate
| view_vouchers_predicate
| view_events_predicate
| view_events_registration_states_predicate
)
rules.add_perm("paweljong.view_menu", can_view_menu_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