From 01dc6a1cd4f3f0d9b3dd1e685025c6d9abaf29f1 Mon Sep 17 00:00:00 2001 From: Alfredos-Panagiotis Damkalis Date: Fri, 29 Nov 2019 00:08:52 +0200 Subject: [PATCH] Fix scheduling permissions for user with online and testing stations Signed-off-by: Alfredos-Panagiotis Damkalis --- network/base/perms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/network/base/perms.py b/network/base/perms.py index 7053060..0266983 100644 --- a/network/base/perms.py +++ b/network/base/perms.py @@ -70,7 +70,11 @@ def schedule_stations_perms(user, stations): # User has online station (status=2) and station is online try: if user.ground_stations.filter(status=2).exists(): - return {station.id: station.status == 2 for station in stations} + return { + s.id: s.status == 2 or (s.owner == user and s.status == 1) + for s in stations + } + except ObjectDoesNotExist: pass # If the station is testing (status=1) and user is its owner