Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
4f289963
Commit
4f289963
authored
Jun 03, 2019
by
BaiJiangJie
Committed by
老广
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改录像回放判断逻辑 (#2768)
parent
9721b805
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
models.py
apps/terminal/models.py
+21
-4
No files found.
apps/terminal/models.py
View file @
4f289963
...
...
@@ -167,6 +167,7 @@ class Session(OrgModelMixin):
upload_to
=
'replay'
ACTIVE_CACHE_KEY_PREFIX
=
'SESSION_ACTIVE_{}'
_DATE_START_FIRST_HAS_REPLAY_RDP_SESSION
=
None
def
get_rel_replay_path
(
self
,
version
=
2
):
"""
...
...
@@ -188,13 +189,29 @@ class Session(OrgModelMixin):
local_path
=
rel_path
return
local_path
@property
def
_date_start_first_has_replay_rdp_session
(
self
):
if
self
.
_DATE_START_FIRST_HAS_REPLAY_RDP_SESSION
is
None
:
instance
=
self
.
__class__
.
objects
.
filter
(
protocol
=
'rdp'
,
has_replay
=
True
)
.
order_by
(
'date_start'
)
.
first
()
if
not
instance
:
return
None
self
.
_DATE_START_FIRST_HAS_REPLAY_RDP_SESSION
=
instance
.
date_start
return
self
.
_DATE_START_FIRST_HAS_REPLAY_RDP_SESSION
def
can_replay
(
self
):
if
self
.
has_replay
:
return
True
version
=
settings
.
VERSION
.
split
(
'.'
)
if
[
int
(
i
)
for
i
in
version
]
>
[
1
,
4
,
8
]:
return
False
return
True
# 判断对RDP Session添加上报has_replay状态机制之前的录像回放
if
self
.
_date_start_first_has_replay_rdp_session
is
None
:
return
True
if
self
.
date_start
<
self
.
_date_start_first_has_replay_rdp_session
:
return
True
return
False
def
save_to_storage
(
self
,
f
):
local_path
=
self
.
get_local_path
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment