Skip to content

Commit

Permalink
perf: 优化组件的操作行为不记录到操作日志中
Browse files Browse the repository at this point in the history
  • Loading branch information
O-Jiangweidong authored and BaiJiangJie committed Aug 17, 2023
1 parent b20abb4 commit c0f3769
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/audits/signal_handlers/operate_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
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 = {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c0f3769

Please sign in to comment.