aboutsummaryrefslogtreecommitdiffstats
path: root/server/views.py
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2021-08-14 11:38:40 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2021-08-14 11:39:38 +0200
commit5f309f54798b1a7a0fe6ef8060a8c9a77b3b6d04 (patch)
tree46353dd8abfe52c535885775b09a0c3c2e16b798 /server/views.py
parentupdate licence and roll back revision (diff)
downloadscout-subs-5f309f54798b1a7a0fe6ef8060a8c9a77b3b6d04.tar.gz
scout-subs-5f309f54798b1a7a0fe6ef8060a8c9a77b3b6d04.zip
fix RO documents visible for non group capi
Diffstat (limited to 'server/views.py')
-rw-r--r--server/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/views.py b/server/views.py
index 1cf3ac7..244bf60 100644
--- a/server/views.py
+++ b/server/views.py
@@ -40,11 +40,13 @@ def isStaff(user):
# function to check if "aggiunto" has permission to view documents
def isCapi_enabled(user):
- group = user.groups.values_list('name', flat=True)[0]
+ groups = user.groups.values_list('name', flat=True)
+ group = groups[0]
settings = GroupSettings.objects.filter(group__name=group)
- if len(settings) == 0:
+ if len(settings) != 0 and "capi" in groups:
+ return settings[0].view_documents
+ else:
return False
- return settings[0].view_documents
@user_passes_test(isStaff)
def index(request):