ignore unknown tasks

This commit is contained in:
j 2018-05-09 15:12:25 +01:00
parent 7c320c7614
commit 099c2610e6

View file

@ -44,7 +44,10 @@ def cancelTask(request, data):
if not isinstance(ids, list): if not isinstance(ids, list):
ids = [ids] ids = [ids]
for id in ids: for id in ids:
task = models.Task.get(id) try:
task = models.Task.get(id)
except models.Task.DoesNotExist:
continue
if task.user != request.user and not request.user.profile.capability('canSeeAllTasks'): if task.user != request.user and not request.user.profile.capability('canSeeAllTasks'):
response = json_response(status=403, text='permission denied') response = json_response(status=403, text='permission denied')
return render_to_json_response(response) return render_to_json_response(response)