diff --git a/apps/authentication/api/auth.py b/apps/authentication/api/auth.py index cc77058ee..310aa3d4a 100644 --- a/apps/authentication/api/auth.py +++ b/apps/authentication/api/auth.py @@ -54,12 +54,3 @@ class UserConnectionTokenApi(RootOrgViewMixin, APIView): return Response(value) else: return Response({'user': value['user']}) - - def get_permissions(self): - if self.request.query_params.get('user-only', None): - self.permission_classes = (AllowAny,) - return super().get_permissions() - - - - diff --git a/apps/ops/ws.py b/apps/ops/ws.py index 17acaf508..f21c79570 100644 --- a/apps/ops/ws.py +++ b/apps/ops/ws.py @@ -21,7 +21,11 @@ class TaskLogWebsocket(JsonWebsocketConsumer): } def connect(self): - self.accept() + user = self.scope["user"] + if user.is_authenticated and user.is_org_admin: + self.accept() + else: + self.close() def get_log_path(self, task_id): func = self.log_types.get(self.log_type)