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
35a0b42b
Unverified
Commit
35a0b42b
authored
Jun 03, 2019
by
BaiJiangJie
Committed by
GitHub
Jun 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2769 from jumpserver/dev
[Update] 修改录像回放判断逻辑 (#2768)
parents
1631c328
4f289963
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
models.py
apps/terminal/models.py
+20
-3
No files found.
apps/terminal/models.py
View file @
35a0b42b
...
@@ -167,6 +167,7 @@ class Session(OrgModelMixin):
...
@@ -167,6 +167,7 @@ class Session(OrgModelMixin):
upload_to
=
'replay'
upload_to
=
'replay'
ACTIVE_CACHE_KEY_PREFIX
=
'SESSION_ACTIVE_{}'
ACTIVE_CACHE_KEY_PREFIX
=
'SESSION_ACTIVE_{}'
_DATE_START_FIRST_HAS_REPLAY_RDP_SESSION
=
None
def
get_rel_replay_path
(
self
,
version
=
2
):
def
get_rel_replay_path
(
self
,
version
=
2
):
"""
"""
...
@@ -188,14 +189,30 @@ class Session(OrgModelMixin):
...
@@ -188,14 +189,30 @@ class Session(OrgModelMixin):
local_path
=
rel_path
local_path
=
rel_path
return
local_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
):
def
can_replay
(
self
):
if
self
.
has_replay
:
if
self
.
has_replay
:
return
True
return
True
version
=
settings
.
VERSION
.
split
(
'.'
)
if
[
int
(
i
)
for
i
in
version
]
>
[
1
,
4
,
8
]:
# 判断对RDP Session添加上报has_replay状态机制之前的录像回放
return
False
if
self
.
_date_start_first_has_replay_rdp_session
is
None
:
return
True
return
True
if
self
.
date_start
<
self
.
_date_start_first_has_replay_rdp_session
:
return
True
return
False
def
save_to_storage
(
self
,
f
):
def
save_to_storage
(
self
,
f
):
local_path
=
self
.
get_local_path
()
local_path
=
self
.
get_local_path
()
try
:
try
:
...
...
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