perf: 资产与节点变化的时候,优化发送推送系统用户信号

This commit is contained in:
xinwen
2021-03-17 10:24:12 +08:00
committed by Jiangjie.Bai
parent d3bbfdc458
commit 817268d7cd
3 changed files with 17 additions and 10 deletions

View File

@@ -87,6 +87,9 @@ class SystemUser(BaseUser):
(PROTOCOL_POSTGRESQL, 'postgresql'),
(PROTOCOL_K8S, 'k8s'),
)
SUPPORT_PUSH_PROTOCOLS = [PROTOCOL_SSH, PROTOCOL_RDP]
ASSET_CATEGORY_PROTOCOLS = [
PROTOCOL_SSH, PROTOCOL_RDP, PROTOCOL_TELNET, PROTOCOL_VNC
]
@@ -151,11 +154,15 @@ class SystemUser(BaseUser):
return self.get_login_mode_display()
def is_need_push(self):
if self.auto_push and self.protocol in [self.PROTOCOL_SSH, self.PROTOCOL_RDP]:
if self.auto_push and self.is_protocol_support_push:
return True
else:
return False
@property
def is_protocol_support_push(self):
return self.protocol in self.SUPPORT_PUSH_PROTOCOLS
@property
def is_need_cmd_filter(self):
return self.protocol not in [self.PROTOCOL_RDP, self.PROTOCOL_VNC]