Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Paweljong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Teckids
Projekt Hack-n-Fun
AlekSIS-App-Paweljong
Commits
727939e9
Commit
727939e9
authored
3 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Add missing permissions for registration states
parent
c593f63a
No related branches found
No related tags found
1 merge request
!15
Resolve "Permissions by group owners"
Pipeline
#59155
failed
3 years ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/paweljong/rules.py
+48
-7
48 additions, 7 deletions
aleksis/apps/paweljong/rules.py
with
48 additions
and
7 deletions
aleksis/apps/paweljong/rules.py
+
48
−
7
View file @
727939e9
...
...
@@ -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
"
,
RegistrationSt
ate
)
view_registrations_predicate
|
view_info_mailing
s_predicate
|
view_terms_predicate
|
view_voucher
s_predicate
|
view_events_predicate
|
view_events
_registration
_
state
s_predic
ate
)
rules
.
add_perm
(
"
paweljong.view_menu
"
,
can_view_menu_predicate
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment