mirror of https://github.com/jumpserver/jumpserver
				
				
				
			
							parent
							
								
									5fae919499
								
							
						
					
					
						commit
						0842553f8a
					
				| 
						 | 
				
			
			@ -1,11 +1,13 @@
 | 
			
		|||
# ~*~ coding: utf-8 ~*~
 | 
			
		||||
import os
 | 
			
		||||
import uuid
 | 
			
		||||
 | 
			
		||||
from django.utils.translation import ugettext_lazy as _
 | 
			
		||||
 | 
			
		||||
from common.utils import get_logger, get_object_or_none
 | 
			
		||||
from common.tasks import send_mail_async
 | 
			
		||||
from orgs.utils import org_aware_func
 | 
			
		||||
from jumpserver.const import PROJECT_DIR
 | 
			
		||||
 | 
			
		||||
from .models import Task, AdHoc
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -79,8 +81,12 @@ def send_server_performance_mail(path, usage, usages):
 | 
			
		|||
 | 
			
		||||
def get_task_log_path(base_path, task_id, level=2):
 | 
			
		||||
    task_id = str(task_id)
 | 
			
		||||
    try:
 | 
			
		||||
        uuid.UUID(task_id)
 | 
			
		||||
    except:
 | 
			
		||||
        return os.path.join(PROJECT_DIR, 'data', 'caution.txt')
 | 
			
		||||
 | 
			
		||||
    rel_path = os.path.join(*task_id[:level], task_id + '.log')
 | 
			
		||||
    path = os.path.join(base_path, rel_path)
 | 
			
		||||
    os.makedirs(os.path.dirname(path), exist_ok=True)
 | 
			
		||||
    return path
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ class TaskLogWebsocket(JsonWebsocketConsumer):
 | 
			
		|||
 | 
			
		||||
    def connect(self):
 | 
			
		||||
        user = self.scope["user"]
 | 
			
		||||
        if user.is_authenticated and user.is_org_admin:
 | 
			
		||||
        if user.is_authenticated:
 | 
			
		||||
            self.accept()
 | 
			
		||||
        else:
 | 
			
		||||
            self.close()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
[1;31m 你想偷看啥 !!!
 | 
			
		||||
[1;31m What are you trying to peek at !!!
 | 
			
		||||
		Loading…
	
		Reference in New Issue