Skip to content

Commit

Permalink
Tweak permissions for volunteer role admin
Browse files Browse the repository at this point in the history
  • Loading branch information
ormiret authored and jellybob committed May 31, 2024
1 parent 19a99f5 commit 0d4399b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/volunteer/choose_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def choose_role():
@v_user_required
def role_admin_index():
roles = []
if current_user.has_permission("admin") or current_user.has_permission("volunteer:manager"):
if (current_user.has_permission("admin") or
current_user.has_permission("volunteer:manager") or
current_user.has_permission("volunteer:admin")):
roles = Role.query.order_by("name").all()
else:
roles = [admin.role for admin in current_user.volunteer_admin_roles]
Expand Down Expand Up @@ -163,7 +165,8 @@ def role_admin_required(f, *args, **kwargs):
if current_user.is_authenticated:
if int(args[0]) in [
ra.role_id for ra in current_user.volunteer_admin_roles
] or current_user.has_permission("volunteer:admin"):
] or (current_user.has_permission("volunteer:admin") or
current_user.has_permission("volunteer:manager")):
return f(*args, **kwargs)
abort(404)
return app.login_manager.unauthorized()
Expand Down

0 comments on commit 0d4399b

Please sign in to comment.