Skip to content

Commit

Permalink
use 423 handler
Browse files Browse the repository at this point in the history
  • Loading branch information
nsyed22 committed Dec 11, 2024
1 parent 495a221 commit 4797ed2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pybossa/view/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ def task_presenter(short_name, task_id, task_submitter_id=None):
"""
mode = request.args.get('mode')
project, owner, ps = project_by_shortname(short_name)
ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)
task = task_repo.get_task(id=task_id)
if task is None:
raise abort(404)
Expand All @@ -1333,7 +1333,7 @@ def task_presenter(short_name, task_id, task_submitter_id=None):
if redirect_to_password:
return redirect_to_password
else:
ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)

if current_user.is_anonymous:
if not project.allow_anonymous_contributors:
Expand Down Expand Up @@ -1465,7 +1465,7 @@ def respond(tmpl):
project, owner, ps = project_by_shortname(short_name)
project.timeout = project.info.get('timeout', DEFAULT_TASK_TIMEOUT)

ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)

if project.needs_password():
redirect_to_password = _check_if_redirect_to_password(project)
Expand Down Expand Up @@ -1532,7 +1532,7 @@ def respond(tmpl):
@blueprint.route('/<short_name>/tutorial')
def tutorial(short_name):
project, owner, ps = project_by_shortname(short_name)
ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)
title = project_title(project, "Tutorial")

if project.needs_password():
Expand Down Expand Up @@ -1631,7 +1631,7 @@ def _get_locks(project_id, task_id):
@login_required
def tasks(short_name):
project, owner, ps = project_by_shortname(short_name)
ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)
title = project_title(project, "Tasks")

if project.needs_password():
Expand Down Expand Up @@ -1671,7 +1671,7 @@ def tasks(short_name):
@login_required
def tasks_browse(short_name, page=1, records_per_page=None):
project, owner, ps = project_by_shortname(short_name)
ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)

title = project_title(project, "Tasks")
pro = pro_features()
Expand Down Expand Up @@ -2584,7 +2584,7 @@ def task_settings(short_name):
"""Settings page for tasks of the project"""
project, owner, ps = project_by_shortname(short_name)

ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)
ensure_authorized_to('update', project)
pro = pro_features()
project = add_custom_contrib_button_to(project, get_user_id_or_ip(), ps=ps)
Expand Down Expand Up @@ -2815,7 +2815,7 @@ def task_timeout(short_name):
title = project_title(project, gettext('Timeout'))
form = TaskTimeoutForm(request.body) if request.data else TaskTimeoutForm()

ensure_authorized_to('read', project)
ensure_authorized_to('read', project, forbidden_code_override=423)
ensure_authorized_to('update', project)
pro = pro_features()
if request.method == 'GET':
Expand Down

0 comments on commit 4797ed2

Please sign in to comment.