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
ef717f88
Commit
ef717f88
authored
Jun 21, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into bugfix
parents
3e73dbdb
90890591
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
81 additions
and
75 deletions
+81
-75
remote_app.py
apps/applications/views/remote_app.py
+4
-4
vault.py
apps/assets/backends/vault.py
+1
-9
asset.py
apps/assets/models/asset.py
+2
-0
asset.py
apps/assets/serializers/asset.py
+7
-8
tasks.py
apps/assets/tasks.py
+15
-8
views.py
apps/audits/views.py
+1
-1
mixins.py
apps/common/mixins.py
+1
-1
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+0
-0
djangojs.mo
apps/locale/zh/LC_MESSAGES/djangojs.mo
+0
-0
djangojs.po
apps/locale/zh/LC_MESSAGES/djangojs.po
+36
-32
mixins.py
apps/perms/mixins.py
+0
-2
api.py
apps/settings/api.py
+1
-1
jumpserver.js
apps/static/js/jumpserver.js
+1
-1
_nav_user.html
apps/templates/_nav_user.html
+4
-0
command.py
apps/terminal/views/command.py
+1
-1
session.py
apps/terminal/views/session.py
+4
-4
terminal.py
apps/terminal/views/terminal.py
+3
-3
No files found.
apps/applications/views/remote_app.py
View file @
ef717f88
...
...
@@ -28,7 +28,7 @@ class RemoteAppListView(PermissionsMixin, TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'A
sset
s'
),
'app'
:
_
(
'A
pplication
s'
),
'action'
:
_
(
'RemoteApp list'
),
}
kwargs
.
update
(
context
)
...
...
@@ -44,7 +44,7 @@ class RemoteAppCreateView(PermissionsMixin, SuccessMessageMixin, CreateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'A
sset
s'
),
'app'
:
_
(
'A
pplication
s'
),
'action'
:
_
(
'Create RemoteApp'
),
}
kwargs
.
update
(
context
)
...
...
@@ -66,7 +66,7 @@ class RemoteAppUpdateView(PermissionsMixin, SuccessMessageMixin, UpdateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'A
sset
s'
),
'app'
:
_
(
'A
pplication
s'
),
'action'
:
_
(
'Update RemoteApp'
),
}
kwargs
.
update
(
context
)
...
...
@@ -84,7 +84,7 @@ class RemoteAppDetailView(PermissionsMixin, DetailView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'A
sset
s'
),
'app'
:
_
(
'A
pplication
s'
),
'action'
:
_
(
'RemoteApp detail'
),
}
kwargs
.
update
(
context
)
...
...
apps/assets/backends/vault.py
View file @
ef717f88
# -*- coding: utf-8 -*-
#
from
.
.
base
import
BaseBackend
from
.base
import
BaseBackend
class
VaultBackend
(
BaseBackend
):
@classmethod
def
get
(
cls
,
username
,
asset
):
pass
@classmethod
def
filter
(
cls
,
username
=
None
,
asset
=
None
,
latest
=
True
):
pass
@classmethod
def
create
(
cls
,
**
kwargs
):
pass
apps/assets/models/asset.py
View file @
ef717f88
...
...
@@ -229,6 +229,8 @@ class Asset(OrgModelMixin):
@property
def
connectivity
(
self
):
if
not
self
.
admin_user
:
return
self
.
UNKNOWN
return
self
.
admin_user
.
get_connectivity_of
(
self
)
@connectivity.setter
...
...
apps/assets/serializers/asset.py
View file @
ef717f88
...
...
@@ -27,8 +27,6 @@ class ProtocolsRelatedField(serializers.RelatedField):
return
str
(
value
)
def
to_internal_value
(
self
,
data
):
print
(
data
)
print
(
type
(
data
))
if
isinstance
(
data
,
dict
):
return
data
if
'/'
not
in
data
:
...
...
@@ -152,7 +150,9 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
"""
被授权资产的数据结构
"""
protocols
=
ProtocolSerializer
(
many
=
True
)
protocols
=
ProtocolsRelatedField
(
many
=
True
,
queryset
=
Protocol
.
objects
.
all
(),
label
=
_
(
"Protocols"
)
)
system_users_granted
=
AssetSystemUserSerializer
(
many
=
True
,
read_only
=
True
)
system_users_join
=
serializers
.
SerializerMethodField
()
# nodes = NodeTMPSerializer(many=True, read_only=True)
...
...
@@ -160,9 +160,9 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Asset
fields
=
(
"id"
,
"hostname"
,
"ip"
,
"protocol
s"
,
"system_users_granted
"
,
"
is_active"
,
"system_users_join"
,
"os"
,
'domain'
,
"platform"
,
"comment"
,
"org_id"
,
"org_name"
,
"id"
,
"hostname"
,
"ip"
,
"protocol
"
,
"port"
,
"protocols
"
,
"
system_users_granted"
,
"is_active"
,
"system_users_join"
,
"os"
,
'domain'
,
"platform"
,
"comment"
,
"org_id"
,
"org_name"
,
)
@staticmethod
...
...
@@ -187,8 +187,7 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
class
AssetSimpleSerializer
(
serializers
.
ModelSerializer
):
protocols
=
ProtocolSerializer
(
many
=
True
)
class
Meta
:
model
=
Asset
fields
=
[
'id'
,
'hostname'
,
'ip'
,
'
protocols'
,
'
connectivity'
,
'port'
]
fields
=
[
'id'
,
'hostname'
,
'ip'
,
'connectivity'
,
'port'
]
apps/assets/tasks.py
View file @
ef717f88
...
...
@@ -209,9 +209,13 @@ def test_asset_connectivity_util(assets, task_name=None):
)
result
=
task
.
run
()
summary
=
result
[
1
]
results_summary
[
'success'
]
&=
summary
[
'success'
]
results_summary
[
'contacted'
]
.
update
(
summary
[
'contacted'
])
results_summary
[
'dark'
]
.
update
(
summary
[
'dark'
])
success
=
summary
.
get
(
'success'
,
False
)
contacted
=
summary
.
get
(
'contacted'
,
{})
dark
=
summary
.
get
(
'dark'
,
{})
results_summary
[
'success'
]
&=
success
results_summary
[
'contacted'
]
.
update
(
contacted
)
results_summary
[
'dark'
]
.
update
(
dark
)
for
asset
in
assets
:
if
asset
.
hostname
in
results_summary
.
get
(
'dark'
,
{}):
...
...
@@ -330,14 +334,17 @@ def test_system_user_connectivity_util(system_user, assets, task_name):
task
,
created
=
update_or_create_ansible_task
(
task_name
=
task_name
,
hosts
=
value
[
'hosts'
],
tasks
=
value
[
'tasks'
],
pattern
=
'all'
,
options
=
const
.
TASK_OPTIONS
,
run_as
=
system_user
.
username
,
created_by
=
system_user
.
org_id
,
run_as
=
system_user
.
username
,
created_by
=
system_user
.
org_id
,
)
result
=
task
.
run
()
summary
=
result
[
1
]
results_summary
[
'success'
]
&=
summary
[
'success'
]
results_summary
[
'contacted'
]
.
update
(
summary
[
'contacted'
])
results_summary
[
'dark'
]
.
update
(
summary
[
'dark'
])
success
=
summary
.
get
(
'success'
,
False
)
contacted
=
summary
.
get
(
'contacted'
,
{})
dark
=
summary
.
get
(
'dark'
,
{})
results_summary
[
'success'
]
&=
success
results_summary
[
'contacted'
]
.
update
(
contacted
)
results_summary
[
'dark'
]
.
update
(
dark
)
set_system_user_connectivity_info
(
system_user
,
results_summary
)
return
results_summary
...
...
apps/audits/views.py
View file @
ef717f88
...
...
@@ -248,7 +248,7 @@ class CommandExecutionListView(UserCommandExecutionListView):
'keyword'
:
self
.
keyword
,
'user_id'
:
self
.
user_id
,
})
return
super
()
.
get_context_data
(
**
context
)
return
context
@method_decorator
(
csrf_exempt
,
name
=
'dispatch'
)
...
...
apps/common/mixins.py
View file @
ef717f88
...
...
@@ -224,7 +224,7 @@ class ApiMessageMixin:
def
dispatch
(
self
,
request
,
*
args
,
**
kwargs
):
resp
=
super
()
.
dispatch
(
request
,
*
args
,
**
kwargs
)
if
request
.
method
.
lower
()
in
(
"get"
,
"delete"
):
if
request
.
method
.
lower
()
in
(
"get"
,
"delete"
,
"patch"
):
return
resp
if
resp
.
status_code
>=
400
:
return
resp
...
...
apps/locale/zh/LC_MESSAGES/django.mo
View file @
ef717f88
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
ef717f88
This diff is collapsed.
Click to expand it.
apps/locale/zh/LC_MESSAGES/djangojs.mo
View file @
ef717f88
No preview for this file type
apps/locale/zh/LC_MESSAGES/djangojs.po
View file @
ef717f88
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-0
5-27 15:53
+0800\n"
"POT-Creation-Date: 2019-0
6-20 16:30
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
@@ -17,58 +17,58 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: static/js/jumpserver.js:2
49
#: static/js/jumpserver.js:2
63
msgid "Update is successful!"
msgstr "更新成功"
#: static/js/jumpserver.js:2
51
#: static/js/jumpserver.js:2
65
msgid "An unknown error occurred while updating.."
msgstr "更新时发生未知错误"
#: static/js/jumpserver.js:3
15 static/js/jumpserver.js:352
#: static/js/jumpserver.js:3
55
#: static/js/jumpserver.js:3
29 static/js/jumpserver.js:366
#: static/js/jumpserver.js:3
69
msgid "Error"
msgstr "错误"
#: static/js/jumpserver.js:3
15
#: static/js/jumpserver.js:3
29
msgid "Being used by the asset, please unbind the asset first."
msgstr "正在被资产使用中,请先解除资产绑定"
#: static/js/jumpserver.js:3
21 static/js/jumpserver.js:362
#: static/js/jumpserver.js:3
35 static/js/jumpserver.js:376
msgid "Delete the success"
msgstr "删除成功"
#: static/js/jumpserver.js:3
27
#: static/js/jumpserver.js:3
41
msgid "Are you sure about deleting it?"
msgstr "你确定删除吗 ?"
#: static/js/jumpserver.js:3
31 static/js/jumpserver.js:372
#: static/js/jumpserver.js:3
45 static/js/jumpserver.js:386
msgid "Cancel"
msgstr "取消"
#: static/js/jumpserver.js:3
33 static/js/jumpserver.js:374
#: static/js/jumpserver.js:3
47 static/js/jumpserver.js:388
msgid "Confirm"
msgstr "确认"
#: static/js/jumpserver.js:3
52
#: static/js/jumpserver.js:3
66
msgid ""
"The organization contains undeleted information. Please try again after "
"deleting"
msgstr "组织中包含未删除信息,请删除后重试"
#: static/js/jumpserver.js:3
55
#: static/js/jumpserver.js:3
69
msgid ""
"Do not perform this operation under this organization. Try again after "
"switching to another organization"
msgstr "请勿在此组织下执行此操作,切换到其他组织后重试"
#: static/js/jumpserver.js:3
68
#: static/js/jumpserver.js:3
82
msgid ""
"Please ensure that the following information in the organization has been "
"deleted"
msgstr "请确保组织内的以下信息已删除"
#: static/js/jumpserver.js:3
69
#: static/js/jumpserver.js:3
83
msgid ""
"User list、User group、Asset list、Domain list、Admin user、System user、"
"Labels、Asset permission"
...
...
@@ -76,76 +76,80 @@ msgstr ""
"用户列表、用户组、资产列表、网域列表、管理用户、系统用户、标签管理、资产授权"
"规则"
#: static/js/jumpserver.js:4
08
#: static/js/jumpserver.js:4
22
msgid "Loading ..."
msgstr "加载中 ..."
#: static/js/jumpserver.js:4
09
#: static/js/jumpserver.js:4
23
msgid "Search"
msgstr "搜索"
#: static/js/jumpserver.js:4
12
#: static/js/jumpserver.js:4
26
#, javascript-format
msgid "Selected item %d"
msgstr "选中 %d 项"
#: static/js/jumpserver.js:4
16
#: static/js/jumpserver.js:4
30
msgid "Per page _MENU_"
msgstr "每页 _MENU_"
#: static/js/jumpserver.js:4
17
#: static/js/jumpserver.js:4
31
msgid ""
"Displays the results of items _START_ to _END_; A total of _TOTAL_ entries"
msgstr "显示第 _START_ 至 _END_ 项结果; 总共 _TOTAL_ 项"
#: static/js/jumpserver.js:4
20
#: static/js/jumpserver.js:4
34
msgid "No match"
msgstr "没有匹配项"
#: static/js/jumpserver.js:4
21
#: static/js/jumpserver.js:4
35
msgid "No record"
msgstr "没有记录"
#: static/js/jumpserver.js:5
63
#: static/js/jumpserver.js:5
77
msgid "Unknown error occur"
msgstr ""
#: static/js/jumpserver.js:8
00
#: static/js/jumpserver.js:8
16
msgid "Password minimum length {N} bits"
msgstr "密码最小长度 {N} 位"
#: static/js/jumpserver.js:8
01
#: static/js/jumpserver.js:8
17
msgid "Must contain capital letters"
msgstr "必须包含大写字母"
#: static/js/jumpserver.js:8
02
#: static/js/jumpserver.js:8
18
msgid "Must contain lowercase letters"
msgstr "必须包含小写字母"
#: static/js/jumpserver.js:8
03
#: static/js/jumpserver.js:8
19
msgid "Must contain numeric characters"
msgstr "必须包含数字字符"
#: static/js/jumpserver.js:8
04
#: static/js/jumpserver.js:8
20
msgid "Must contain special characters"
msgstr "必须包含特殊字符"
#: static/js/jumpserver.js:9
76
#: static/js/jumpserver.js:9
95
msgid "Export failed"
msgstr "导出失败"
#: static/js/jumpserver.js:
993
#: static/js/jumpserver.js:
1012
msgid "Import Success"
msgstr "导入成功"
#: static/js/jumpserver.js:
998
#: static/js/jumpserver.js:
1017
msgid "Update Success"
msgstr "更新成功"
#: static/js/jumpserver.js:1028
#: static/js/jumpserver.js:1018
msgid "Count"
msgstr "数量"
#: static/js/jumpserver.js:1047
msgid "Import failed"
msgstr "导入失败"
#: static/js/jumpserver.js:10
33
#: static/js/jumpserver.js:10
52
msgid "Update failed"
msgstr "更新失败"
apps/perms/mixins.py
View file @
ef717f88
# ~*~ coding: utf-8 ~*~
#
from
orgs.utils
import
set_to_root_org
__all__
=
[
...
...
@@ -116,4 +115,3 @@ class ChangeOrgIfNeedMixin(object):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
change_org_if_need
(
request
,
kwargs
)
return
super
()
.
get
(
request
,
*
args
,
**
kwargs
)
apps/settings/api.py
View file @
ef717f88
...
...
@@ -39,7 +39,7 @@ class MailTestingAPI(APIView):
subject
=
"Test"
message
=
"Test smtp setting"
email_from
=
email_from
or
email_host_user
send_mail
(
subject
,
message
,
email_from
,
[
email_
host_user
])
send_mail
(
subject
,
message
,
email_from
,
[
email_
from
])
except
Exception
as
e
:
return
Response
({
"error"
:
str
(
e
)},
status
=
401
)
...
...
apps/static/js/jumpserver.js
View file @
ef717f88
...
...
@@ -1015,7 +1015,7 @@ function APIImportData(props){
$
(
'#updated_failed'
).
html
(
''
);
$
(
'#updated_failed_detail'
).
html
(
''
);
$
(
'#success_updated'
).
html
(
gettext
(
"Update Success"
));
$
(
'#success_updated_detail'
).
html
(
"Count"
+
": "
+
data
.
length
);
$
(
'#success_updated_detail'
).
html
(
gettext
(
"Count"
)
+
": "
+
data
.
length
);
}
props
.
data_table
.
ajax
.
reload
()
...
...
apps/templates/_nav_user.html
View file @
ef717f88
...
...
@@ -4,6 +4,8 @@
<i
class=
"fa fa-files-o"
style=
"width: 14px"
></i><span
class=
"nav-label"
>
{% trans 'My assets' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
</li>
{% if LICENSE_VALID %}
<li
id=
"applications"
>
<a>
<i
class=
"fa fa-th"
style=
"width: 14px"
></i>
<span
class=
"nav-label"
>
{% trans 'My Applications' %}
</span><span
class=
"fa arrow"
></span>
...
...
@@ -16,6 +18,8 @@
</li>
</ul>
</li>
{% endif %}
{% if SECURITY_COMMAND_EXECUTION %}
<li
id=
"ops"
>
<a
href=
"{% url 'ops:command-execution-start' %}"
>
...
...
apps/terminal/views/command.py
View file @
ef717f88
...
...
@@ -48,7 +48,7 @@ class CommandListView(DatetimeSearchMixin, PermissionsMixin, ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'
Terminal
'
),
'app'
:
_
(
'
Sessions
'
),
'action'
:
_
(
'Command list'
),
'user_list'
:
utils
.
get_session_user_list
(),
'asset_list'
:
utils
.
get_session_asset_list
(),
...
...
apps/terminal/views/session.py
View file @
ef717f88
...
...
@@ -71,7 +71,7 @@ class SessionOnlineListView(SessionListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'
Terminal
'
),
'app'
:
_
(
'
Sessions
'
),
'action'
:
_
(
'Session online list'
),
'type'
:
'online'
,
'now'
:
timezone
.
now
(),
...
...
@@ -89,8 +89,8 @@ class SessionOfflineListView(SessionListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'
Terminal
'
),
'action'
:
_
(
'Session offline
list
'
),
'app'
:
_
(
'
Sessions
'
),
'action'
:
_
(
'Session offline'
),
'now'
:
timezone
.
now
(),
}
kwargs
.
update
(
context
)
...
...
@@ -113,7 +113,7 @@ class SessionDetailView(SingleObjectMixin, PermissionsMixin, ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'
Terminal
'
),
'app'
:
_
(
'
Sessions
'
),
'action'
:
_
(
'Session detail'
),
}
kwargs
.
update
(
context
)
...
...
apps/terminal/views/terminal.py
View file @
ef717f88
...
...
@@ -28,7 +28,7 @@ class TerminalListView(PermissionsMixin, ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
TerminalListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
_
(
'
Terminal
'
),
'app'
:
_
(
'
Sessions
'
),
'action'
:
_
(
'Terminal list'
),
'form'
:
self
.
form_class
()
})
...
...
@@ -44,7 +44,7 @@ class TerminalUpdateView(PermissionsMixin, UpdateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
TerminalUpdateView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
_
(
'
Terminal
'
),
'action'
:
_
(
'Update terminal'
)})
context
.
update
({
'app'
:
_
(
'
Sessions
'
),
'action'
:
_
(
'Update terminal'
)})
return
context
...
...
@@ -57,7 +57,7 @@ class TerminalDetailView(PermissionsMixin, DetailView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
TerminalDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
_
(
'
Terminal
'
),
'app'
:
_
(
'
Sessions
'
),
'action'
:
_
(
'Terminal detail'
)
})
return
context
...
...
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