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
41f1c3f7
Commit
41f1c3f7
authored
Jan 21, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] terminal config load
parent
b936d54a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
api.py
apps/terminal/api.py
+5
-2
models.py
apps/terminal/models.py
+12
-2
api_urls.py
apps/terminal/urls/api_urls.py
+2
-1
No files found.
apps/terminal/api.py
View file @
41f1c3f7
...
@@ -262,8 +262,11 @@ class SessionReplayViewSet(viewsets.ViewSet):
...
@@ -262,8 +262,11 @@ class SessionReplayViewSet(viewsets.ViewSet):
return
HttpResponseNotFound
()
return
HttpResponseNotFound
()
class
Load
Config
(
APIView
):
class
Terminal
Config
(
APIView
):
permission_classes
=
(
IsAppUser
,)
permission_classes
=
(
IsAppUser
,)
def
get
(
self
,
request
):
def
get
(
self
,
request
):
pass
user
=
request
.
user
terminal
=
user
.
terminal
configs
=
terminal
.
config
return
Response
(
configs
,
status
=
200
)
apps/terminal/models.py
View file @
41f1c3f7
...
@@ -44,14 +44,24 @@ class Terminal(models.Model):
...
@@ -44,14 +44,24 @@ class Terminal(models.Model):
self
.
user
.
save
()
self
.
user
.
save
()
def
get_common_storage
(
self
):
def
get_common_storage
(
self
):
pass
storage_all
=
settings
.
TERMINAL_COMMAND_STORAGE
if
self
.
command_storage
in
storage_all
:
storage
=
storage_all
.
get
(
self
.
command_storage
)
else
:
storage
=
storage_all
.
get
(
'default'
)
return
{
"TERMINAL_COMMAND_STORAGE"
:
storage
}
def
get_replay_storage
(
self
):
def
get_replay_storage
(
self
):
pass
pass
@property
@property
def
config
(
self
):
def
config
(
self
):
return
configs
=
{}
for
k
in
dir
(
settings
):
if
k
.
startswith
(
'TERMINAL'
):
configs
[
k
]
=
getattr
(
settings
,
k
)
configs
.
update
(
self
.
get_common_storage
())
return
configs
def
create_app_user
(
self
):
def
create_app_user
(
self
):
random
=
uuid
.
uuid4
()
.
hex
[:
6
]
random
=
uuid
.
uuid4
()
.
hex
[:
6
]
...
...
apps/terminal/urls/api_urls.py
View file @
41f1c3f7
...
@@ -20,7 +20,8 @@ urlpatterns = [
...
@@ -20,7 +20,8 @@ urlpatterns = [
url
(
r'^v1/sessions/(?P<pk>[0-9a-zA-Z\-]{36})/replay/$'
,
url
(
r'^v1/sessions/(?P<pk>[0-9a-zA-Z\-]{36})/replay/$'
,
api
.
SessionReplayViewSet
.
as_view
({
'get'
:
'retrieve'
,
'post'
:
'create'
}),
api
.
SessionReplayViewSet
.
as_view
({
'get'
:
'retrieve'
,
'post'
:
'create'
}),
name
=
'session-replay'
),
name
=
'session-replay'
),
url
(
r'^v1/terminal/(?P<terminal>[a-zA-Z0-9\-]{36})/access-key'
,
api
.
TerminalTokenApi
.
as_view
(),
name
=
'terminal-access-key'
)
url
(
r'^v1/terminal/(?P<terminal>[a-zA-Z0-9\-]{36})/access-key'
,
api
.
TerminalTokenApi
.
as_view
(),
name
=
'terminal-access-key'
),
url
(
r'^v1/terminal/config'
,
api
.
TerminalConfig
.
as_view
(),
name
=
'terminal-config'
),
]
]
urlpatterns
+=
router
.
urls
urlpatterns
+=
router
.
urls
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