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
5931c5a0
Commit
5931c5a0
authored
Nov 19, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] terminal配置修改
parent
742200e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
models.py
apps/terminal/models.py
+7
-4
No files found.
apps/terminal/models.py
View file @
5931c5a0
...
...
@@ -10,6 +10,7 @@ from django.conf import settings
from
users.models
import
User
from
orgs.mixins
import
OrgModelMixin
from
common.models
import
common_settings
from
common.utils
import
get_command_storage_setting
,
get_replay_storage_setting
from
.backends.command.models
import
AbstractSessionCommand
...
...
@@ -40,7 +41,7 @@ class Terminal(models.Model):
self
.
user
.
save
()
def
get_common_storage
(
self
):
storage_all
=
settings
.
TERMINAL_COMMAND_STORAGE
storage_all
=
get_command_storage_setting
()
if
self
.
command_storage
in
storage_all
:
storage
=
storage_all
.
get
(
self
.
command_storage
)
else
:
...
...
@@ -48,7 +49,7 @@ class Terminal(models.Model):
return
{
"TERMINAL_COMMAND_STORAGE"
:
storage
}
def
get_replay_storage
(
self
):
storage_all
=
settings
.
TERMINAL_REPLAY_STORAGE
storage_all
=
get_replay_storage_setting
()
if
self
.
replay_storage
in
storage_all
:
storage
=
storage_all
.
get
(
self
.
replay_storage
)
else
:
...
...
@@ -60,7 +61,7 @@ class Terminal(models.Model):
configs
=
{}
for
k
in
dir
(
settings
):
if
k
.
startswith
(
'TERMINAL'
):
configs
[
k
]
=
getattr
(
settings
,
k
)
configs
[
k
]
=
getattr
(
common_
settings
,
k
)
configs
.
update
(
self
.
get_common_storage
())
configs
.
update
(
self
.
get_replay_storage
())
configs
.
update
({
...
...
@@ -70,7 +71,9 @@ class Terminal(models.Model):
def
create_app_user
(
self
):
random
=
uuid
.
uuid4
()
.
hex
[:
6
]
user
,
access_key
=
User
.
create_app_user
(
name
=
"{}-{}"
.
format
(
self
.
name
,
random
),
comment
=
self
.
comment
)
user
,
access_key
=
User
.
create_app_user
(
name
=
"{}-{}"
.
format
(
self
.
name
,
random
),
comment
=
self
.
comment
)
self
.
user
=
user
self
.
save
()
return
user
,
access_key
...
...
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