Browse Source

Extra check for logged in user which is not a researcher (like an admin)

master
Joshua Rubingh 6 months ago
parent
commit
ab62a6cbc8
  1. 3
      VRE/apps/study/views.py

3
VRE/apps/study/views.py

@ -43,6 +43,9 @@ class Studies(ModelViewSet): @@ -43,6 +43,9 @@ class Studies(ModelViewSet):
if getattr(self, 'swagger_fake_view', False):
return self.queryset
if not hasattr(self.request.user,'researcher'):
raise PermissionDenied(_('Illegal user'))
return Study.objects.filter(contributors__in=[self.request.user.researcher]).order_by('name')
def _valid_study_field_check(self, serializer):

Loading…
Cancel
Save