mirror of https://github.com/jumpserver/jumpserver
perf: 优化组件的操作行为不记录到操作日志中
parent
b20abb494f
commit
c0f3769f9f
|
@ -14,6 +14,7 @@ from audits.handler import (
|
|||
from audits.utils import model_to_dict_for_operate_log as model_to_dict
|
||||
from common.const.signals import POST_ADD, POST_REMOVE, POST_CLEAR, SKIP_SIGNAL
|
||||
from common.signals import django_ready
|
||||
from jumpserver.utils import current_request
|
||||
from ..const import MODELS_NEED_RECORD, ActionChoices
|
||||
|
||||
M2M_ACTION = {
|
||||
|
@ -73,6 +74,10 @@ def signal_of_operate_log_whether_continue(
|
|||
condition = False
|
||||
if instance and getattr(instance, SKIP_SIGNAL, False):
|
||||
condition = False
|
||||
# 不记录组件的操作日志
|
||||
user = current_request.user if current_request else None
|
||||
if not user or user.is_service_account:
|
||||
condition = False
|
||||
# 终端模型的 create 事件由系统产生,不记录
|
||||
if instance._meta.object_name == 'Terminal' and created:
|
||||
condition = False
|
||||
|
|
Loading…
Reference in New Issue