diff --git a/apps/authentication/api/auth.py b/apps/authentication/api/auth.py index cc77058ee2ac321d1261bed07fe48830fcd54a08..310aa3d4a7266a3884923a20db8ef9e004107005 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 343a6a8ee0be16c0ae2e07519be801f356c01261..67e12456a34775e3f0410cac7f40e57bcf5d309e 100644 --- a/apps/ops/ws.py +++ b/apps/ops/ws.py @@ -15,7 +15,11 @@ class CeleryLogWebsocket(JsonWebsocketConsumer): disconnected = False def connect(self): - self.accept() + user = self.scope["user"] + if user.is_authenticated and user.is_org_admin: + self.accept() + else: + self.close() def receive(self, text_data=None, bytes_data=None, **kwargs): data = json.loads(text_data)