mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-04 17:01:09 +00:00
refactor: 重构危险命令告警类型: Warning (#10970)
* refactor: 重构危险命令告警类型: Warning * Update _msg_command_warning.html * Update _msg_command_warning.html * Update command.py * Update django.po * perf: 优化 command acl warning 的代码逻辑 * perf: 优化 command acl warning 的代码逻辑 * perf: 优化 CommandWarningMessage 逻辑 --------- Co-authored-by: fangfang.dong <fangfang.dong@fit2cloud.com> Co-authored-by: Bai <baijiangjie@gmail.com>
This commit is contained in:
@@ -27,6 +27,7 @@ from orgs.mixins.models import JMSOrgBaseModel
|
||||
from perms.models import AssetPermission
|
||||
from perms.utils import UserPermAssetUtil
|
||||
from terminal.notifications import CommandExecutionAlert
|
||||
from terminal.notifications import CommandWarningMessage
|
||||
|
||||
|
||||
def get_parent_keys(key, include_self=True):
|
||||
@@ -398,6 +399,16 @@ class JobExecution(JMSOrgBaseModel):
|
||||
"user": self.creator,
|
||||
}).publish_async()
|
||||
raise Exception("command is rejected by ACL")
|
||||
elif acl.is_action(CommandFilterACL.ActionChoices.warning):
|
||||
# TODO: warning message
|
||||
# user = ''
|
||||
# command = {
|
||||
# 'user': '',
|
||||
# 'user_id': ''
|
||||
# }
|
||||
# CommandWarningMessage(user, command).publish_async()
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def check_command_acl(self):
|
||||
|
Reference in New Issue
Block a user