Skip to content

Commit

Permalink
Merge pull request #1698 from emfcamp/vol_permission_fix
Browse files Browse the repository at this point in the history
Tweak permissions for volunteer role admin
  • Loading branch information
jellybob committed May 31, 2024
2 parents 19a99f5 + 0d4399b commit f6af6d6
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 f6af6d6

Please sign in to comment.