mirror of https://github.com/jumpserver/jumpserver
parent
043d24a8f7
commit
08ed363d44
|
@ -2,6 +2,7 @@
|
||||||
#
|
#
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.timezone import get_current_timezone
|
from django.utils.timezone import get_current_timezone
|
||||||
|
@ -101,6 +102,10 @@ def get_celery_periodic_task(task_name):
|
||||||
|
|
||||||
def get_celery_task_log_path(task_id):
|
def get_celery_task_log_path(task_id):
|
||||||
task_id = str(task_id)
|
task_id = str(task_id)
|
||||||
|
try:
|
||||||
|
uuid.UUID(task_id)
|
||||||
|
except:
|
||||||
|
return
|
||||||
rel_path = os.path.join(task_id[0], task_id[1], task_id + '.log')
|
rel_path = os.path.join(task_id[0], task_id[1], task_id + '.log')
|
||||||
path = os.path.join(settings.CELERY_LOG_DIR, rel_path)
|
path = os.path.join(settings.CELERY_LOG_DIR, rel_path)
|
||||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CeleryLogWebsocket(JsonWebsocketConsumer):
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
user = self.scope["user"]
|
user = self.scope["user"]
|
||||||
if user.is_authenticated and user.is_org_admin:
|
if user.is_authenticated:
|
||||||
self.accept()
|
self.accept()
|
||||||
else:
|
else:
|
||||||
self.close()
|
self.close()
|
||||||
|
|
Loading…
Reference in New Issue