Skip to content

Commit

Permalink
Fix permissions check on transcode jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jrtcppv committed Nov 24, 2024
1 parent f144017 commit d1e384c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/main/rest/_fine_grain_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def has_permission(self, request, view):
if project is None:
raise Http404
elif "uid" in view.kwargs:
uid = view.kwargs["uid"]
jobs = get_jobs(f"uid={uid}")
if len(jobs) == 0:
raise Http404
project = get_object_or_404(Project, pk=_job_project(jobs[0]))
# Have to get the object to know its project
job = view._get(view.params)
if "job" in job:
job = job["job"]
project = get_object_or_404(Project, pk=job["project"])
elif "elemental_id" in view.kwargs:
elemental_id = view.kwargs["elemental_id"]

Expand Down
2 changes: 2 additions & 0 deletions api/main/rest/_legacy_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def has_permission(self, request, view):
elif "uid" in view.kwargs:
# Have to get the object to know its project
job = view._get(view.params)
if "job" in job:
job = job["job"]
project = get_object_or_404(Project, pk=job["project"])
elif "elemental_id" in view.kwargs:
elemental_id = view.kwargs["elemental_id"]
Expand Down

0 comments on commit d1e384c

Please sign in to comment.