Skip to content

Commit ee663a4

Browse files
committed
API: improve download authorisation check
1 parent 09ef19b commit ee663a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

web/apiv2/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,11 @@ def tasks_report(request, task_id, report_format="json", make_zip=False):
11671167
resp = {"error": True, "error_value": "Task Report API is Disabled"}
11681168
return Response(resp)
11691169

1170+
allow_dl = False
1171+
if hasattr(request.user, "userprofile") and request.user.userprofile.reports:
1172+
allow_dl = True
11701173
# check if allowed to download to all + if no if user has permissions
1171-
if not settings.ALLOW_DL_REPORTS_TO_ALL and not request.user.userprofile.reports:
1174+
if not settings.ALLOW_DL_REPORTS_TO_ALL and allow_dl is False:
11721175
return render(
11731176
request,
11741177
"error.html",

0 commit comments

Comments
 (0)