mirror of https://github.com/jumpserver/jumpserver
feat(session): session列表返回can_termination字段值;设置所有db协议类型会话不可被终断和监控
parent
487932590b
commit
8a693d9fa7
|
@ -257,8 +257,24 @@ class Session(OrgModelMixin):
|
|||
_PROTOCOL = self.PROTOCOL
|
||||
if self.is_finished:
|
||||
return False
|
||||
if self.protocol not in [_PROTOCOL.SSH, _PROTOCOL.TELNET, _PROTOCOL.MYSQL, _PROTOCOL.K8S]:
|
||||
if self.protocol in [_PROTOCOL.SSH, _PROTOCOL.TELNET, _PROTOCOL.K8S]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@property
|
||||
def db_protocols(self):
|
||||
_PROTOCOL = self.PROTOCOL
|
||||
return [_PROTOCOL.MYSQL, _PROTOCOL.MARIADB, _PROTOCOL.ORACLE, _PROTOCOL.POSTGRESQL]
|
||||
|
||||
@property
|
||||
def can_termination(self):
|
||||
_PROTOCOL = self.PROTOCOL
|
||||
if self.is_finished:
|
||||
return False
|
||||
if self.protocol in self.db_protocols:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def save_replay_to_storage(self, f):
|
||||
|
|
|
@ -22,7 +22,7 @@ class SessionSerializer(BulkOrgResourceModelSerializer):
|
|||
"user_id", "asset_id", "system_user_id",
|
||||
"login_from", "login_from_display", "remote_addr",
|
||||
"is_success", "is_finished", "has_replay", "can_replay",
|
||||
"can_join", "protocol", "date_start", "date_end",
|
||||
"can_join", "can_termination", "protocol", "date_start", "date_end",
|
||||
"terminal",
|
||||
]
|
||||
extra_kwargs = {
|
||||
|
|
Loading…
Reference in New Issue