Browse Source

fix: bug

pull/5435/head
ibuler 4 years ago committed by 老广
parent
commit
f04e2fa090
  1. 9
      apps/authentication/api/auth.py
  2. 6
      apps/ops/ws.py

9
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()

6
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)

Loading…
Cancel
Save