Skip to content

GITC-612: prevent users for access bounty owner UI page #9707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,13 @@ def accept_bounty(request):

"""
bounty = handle_bounty_views(request)

is_funder = bounty.is_funder(request.user.username)
is_staff = request.user.is_staff
has_view_privs = is_funder or is_staff
if not has_view_privs:
raise Http404

params = get_context(
ref_object=bounty,
user=request.user if request.user.is_authenticated else None,
Expand Down Expand Up @@ -1570,6 +1577,12 @@ def payout_bounty(request):
"""
bounty = handle_bounty_views(request)

is_funder = bounty.is_funder(request.user.username)
is_staff = request.user.is_staff
has_view_privs = is_funder or is_staff
if not has_view_privs:
raise Http404

params = get_context(
ref_object=bounty,
user=request.user if request.user.is_authenticated else None,
Expand All @@ -1596,6 +1609,12 @@ def bulk_payout_bounty(request):
"""
bounty = handle_bounty_views(request)

is_funder = bounty.is_funder(request.user.username)
is_staff = request.user.is_staff
has_view_privs = is_funder or is_staff
if not has_view_privs:
raise Http404

params = get_context(
ref_object=bounty,
user=request.user if request.user.is_authenticated else None,
Expand Down Expand Up @@ -1660,7 +1679,12 @@ def increase_bounty(request):
"""
bounty = handle_bounty_views(request)
user = request.user if request.user.is_authenticated else None

is_funder = bounty.is_funder(user.username.lower()) if user else False
is_staff = request.user.is_staff
has_view_privs = is_funder or is_staff
if not has_view_privs:
raise Http404

params = get_context(
ref_object=bounty,
Expand Down Expand Up @@ -1699,6 +1723,13 @@ def cancel_bounty(request):

"""
bounty = handle_bounty_views(request)

is_funder = bounty.is_funder(request.user.username)
is_staff = request.user.is_staff
has_view_privs = is_funder or is_staff
if not has_view_privs:
raise Http404

params = get_context(
ref_object=bounty,
user=request.user if request.user.is_authenticated else None,
Expand Down