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
c0829194
Commit
c0829194
authored
Jan 08, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改一些bug, 增加执行task的按钮
parent
dfaf029a
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
138 additions
and
96 deletions
+138
-96
user.py
apps/assets/models/user.py
+5
-1
tasks.py
apps/assets/tasks.py
+6
-2
admin_user_assets.html
apps/assets/templates/assets/admin_user_assets.html
+2
-2
admin_user_detail.html
apps/assets/templates/assets/admin_user_detail.html
+2
-2
asset_detail.html
apps/assets/templates/assets/asset_detail.html
+2
-2
asset_group_detail.html
apps/assets/templates/assets/asset_group_detail.html
+1
-1
cluster_detail.html
apps/assets/templates/assets/cluster_detail.html
+2
-2
system_user_asset.html
apps/assets/templates/assets/system_user_asset.html
+1
-1
system_user_detail.html
apps/assets/templates/assets/system_user_detail.html
+1
-1
utils.py
apps/common/utils.py
+2
-2
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+64
-69
api.py
apps/ops/api.py
+14
-1
task_detail.html
apps/ops/templates/ops/task_detail.html
+1
-1
task_list.html
apps/ops/templates/ops/task_list.html
+24
-1
api_urls.py
apps/ops/urls/api_urls.py
+4
-1
asset_permission_detail.html
apps/perms/templates/perms/asset_permission_detail.html
+2
-2
terminal_detail.html
apps/terminal/templates/terminal/terminal_detail.html
+1
-1
user_detail.html
apps/users/templates/users/user_detail.html
+2
-2
user_group_detail.html
apps/users/templates/users/user_group_detail.html
+2
-2
No files found.
apps/assets/models/user.py
View file @
c0829194
...
...
@@ -81,7 +81,11 @@ class AssetUser(models.Model):
@property
def
public_key
(
self
):
return
signer
.
unsign
(
self
.
_public_key
)
key
=
signer
.
unsign
(
self
.
_public_key
)
if
key
:
return
key
else
:
return
None
@property
def
public_key_obj
(
self
):
...
...
apps/assets/tasks.py
View file @
c0829194
...
...
@@ -25,7 +25,7 @@ disk_pattern = re.compile(r'^hd|sd|xvd')
@shared_task
def
set_assets_hardware_info
(
result
,
**
kwargs
):
"""
U
n
sing ops task run result, to update asset info
Using ops task run result, to update asset info
@shared_task must be exit, because we using it as a task callback, is must
be a celery task also
...
...
@@ -309,6 +309,10 @@ def test_system_user_connectability_period():
#### Push system user tasks ####
def
get_push_system_user_tasks
(
system_user
):
# Set root as system user is dangerous
if
system_user
.
username
==
"root"
:
return
[]
tasks
=
[
{
'name'
:
'Add user {}'
.
format
(
system_user
.
username
),
...
...
@@ -316,7 +320,7 @@ def get_push_system_user_tasks(system_user):
'module'
:
'user'
,
'args'
:
'name={} shell={} state=present password={}'
.
format
(
system_user
.
username
,
system_user
.
shell
,
encrypt_password
(
system_user
.
password
),
encrypt_password
(
system_user
.
password
,
salt
=
"K3mIlKK"
),
),
}
},
...
...
apps/assets/templates/assets/admin_user_assets.html
View file @
c0829194
...
...
@@ -21,11 +21,11 @@
<a
href=
"{% url 'assets:admin-user-assets' pk=admin_user.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Assets list' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:admin-user-update' pk=admin_user.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:admin-user-update' pk=admin_user.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-danger btn-delete-admin-user"
>
<i
class=
"fa fa-
edit"
></i>
Delete
<i
class=
"fa fa-
trash-o"
></i>
{% trans 'Delete' %}
</a>
</li>
</ul>
...
...
apps/assets/templates/assets/admin_user_detail.html
View file @
c0829194
...
...
@@ -21,11 +21,11 @@
<a
href=
"{% url 'assets:admin-user-assets' pk=admin_user.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Assets list' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:admin-user-update' pk=admin_user.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:admin-user-update' pk=admin_user.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-danger btn-delete-admin-user"
>
<i
class=
"fa fa-
edit"
></i>
Delete
<i
class=
"fa fa-
trash-o"
></i>
{% trans 'Delete' %}
</a>
</li>
</ul>
...
...
apps/assets/templates/assets/asset_detail.html
View file @
c0829194
...
...
@@ -21,11 +21,11 @@
</li>
{% if user.is_superuser %}
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:asset-update' pk=asset.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:asset-update' pk=asset.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-danger btn-delete-asset"
>
<i
class=
"fa fa-
edit"
></i>
Delete
<i
class=
"fa fa-
trash-o"
></i>
{% trans 'Delete' %}
</a>
</li>
{% endif %}
...
...
apps/assets/templates/assets/asset_group_detail.html
View file @
c0829194
...
...
@@ -15,7 +15,7 @@
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
><a
href=
""
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Group assets' %}
</a></li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:asset-group-update' pk=asset_group.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:asset-group-update' pk=asset_group.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
</ul>
</div>
...
...
apps/assets/templates/assets/cluster_detail.html
View file @
c0829194
...
...
@@ -22,11 +22,11 @@
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:cluster-update' pk=cluster.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:cluster-update' pk=cluster.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-danger btn-delete-cluster"
>
<i
class=
"fa fa-
edit"
></i>
Delete
<i
class=
"fa fa-
trash-o"
></i>
{% trans 'Delete' %}
</a>
</li>
</ul>
...
...
apps/assets/templates/assets/system_user_asset.html
View file @
c0829194
...
...
@@ -22,7 +22,7 @@
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:system-user-update' pk=system_user.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:system-user-update' pk=system_user.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
</ul>
</div>
...
...
apps/assets/templates/assets/system_user_detail.html
View file @
c0829194
...
...
@@ -23,7 +23,7 @@
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:system-user-update' pk=system_user.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'assets:system-user-update' pk=system_user.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
</ul>
</div>
...
...
apps/common/utils.py
View file @
c0829194
...
...
@@ -287,10 +287,10 @@ def make_signature(access_key_secret, date=None):
return
content_md5
(
data
)
def
encrypt_password
(
password
):
def
encrypt_password
(
password
,
salt
=
None
):
from
passlib.hash
import
sha512_crypt
if
password
:
return
sha512_crypt
.
using
(
rounds
=
5000
)
.
hash
(
password
)
return
sha512_crypt
.
using
(
rounds
=
5000
)
.
hash
(
password
,
salt
=
salt
)
return
None
...
...
apps/locale/zh/LC_MESSAGES/django.mo
View file @
c0829194
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
c0829194
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-0
5 18:1
8+0800\n"
"POT-Creation-Date: 2018-01-0
8 15:5
8+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
...
@@ -18,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
#: assets/forms.py:23 assets/forms.py:53 assets/forms.py:99 perms/forms.py:37
#: perms/templates/perms/asset_permission_asset.html:1
27 users/forms.py:240
#: perms/templates/perms/asset_permission_asset.html:1
16 users/forms.py:242
msgid "Select asset groups"
msgstr "选择资产组"
...
...
@@ -44,7 +44,7 @@ msgstr "默认使用管理用户"
#: assets/forms.py:76 assets/forms.py:81 assets/forms.py:127
#: assets/templates/assets/asset_group_detail.html:70 perms/forms.py:34
#: perms/templates/perms/asset_permission_asset.html:
99 users/forms.py:237
#: perms/templates/perms/asset_permission_asset.html:
88 users/forms.py:239
msgid "Select assets"
msgstr "选择资产"
...
...
@@ -56,7 +56,6 @@ msgstr "选择资产"
#: assets/templates/assets/cluster_assets.html:53
#: assets/templates/assets/system_user_asset.html:54
#: assets/templates/assets/user_asset_list.html:21
#: perms/templates/perms/asset_permission_asset.html:56
#: users/templates/users/user_group_granted_asset.html:51
msgid "Port"
msgstr "端口"
...
...
@@ -78,7 +77,7 @@ msgid "Asset"
msgstr "资产"
#: assets/forms.py:156 perms/forms.py:40
#: perms/templates/perms/asset_permission_detail.html:144 users/forms.py:24
3
#: perms/templates/perms/asset_permission_detail.html:144 users/forms.py:24
5
msgid "Select system users"
msgstr "选择系统用户"
...
...
@@ -535,7 +534,7 @@ msgstr "定期更新资产硬件信息"
#: assets/tasks.py:189
msgid "Test admin user connectability period: {}"
msgstr "定期测试管理用户可
以
连接性: {}"
msgstr "定期测试管理用户可连接性: {}"
#: assets/tasks.py:203
msgid "Test admin user connectability: {}"
...
...
@@ -551,15 +550,15 @@ msgstr "测试系统用户可连接性: {}"
#: assets/tasks.py:295
msgid "Test system user connectability period: {}"
msgstr "测试系统用户可连接性: {}"
msgstr "
定期
测试系统用户可连接性: {}"
#: assets/tasks.py:372
msgid "Push system user to cluster assets: {}"
msgstr "推送系统用户到资产: {}"
#: assets/tasks.py:393
msgid "Push
system user to cluster assets period: {}->
{}"
msgstr "定期推送
系统用户到资产: {}->
{}"
msgid "Push
cluster system users to assets period:
{}"
msgstr "定期推送
集群系统用户到资产:
{}"
#: assets/templates/assets/_asset_group_bulk_update_modal.html:5
msgid "Update asset group"
...
...
@@ -658,7 +657,7 @@ msgstr "其它"
#: assets/templates/assets/admin_user_create_update.html:45
#: assets/templates/assets/asset_bulk_update.html:23
#: assets/templates/assets/asset_create.html:40
#: assets/templates/assets/asset_update.html:5
6
#: assets/templates/assets/asset_update.html:5
5
#: assets/templates/assets/cluster_create_update.html:54
#: perms/templates/perms/asset_permission_create_update.html:67
#: terminal/templates/terminal/terminal_update.html:45
...
...
@@ -677,7 +676,7 @@ msgstr "重置"
#: assets/templates/assets/asset_bulk_update.html:24
#: assets/templates/assets/asset_create.html:41
#: assets/templates/assets/asset_list.html:55
#: assets/templates/assets/asset_update.html:5
7
#: assets/templates/assets/asset_update.html:5
6
#: assets/templates/assets/cluster_create_update.html:55
#: perms/templates/perms/asset_permission_create_update.html:68
#: terminal/templates/terminal/terminal_update.html:46
...
...
@@ -771,7 +770,7 @@ msgstr "使用集群管理用户"
#: assets/templates/assets/admin_user_detail.html:101
#: assets/templates/assets/asset_detail.html:230
#: assets/templates/assets/asset_group_list.html:8
7
#: assets/templates/assets/asset_group_list.html:8
5
#: assets/templates/assets/asset_list.html:202
#: assets/templates/assets/cluster_assets.html:104
#: assets/templates/assets/cluster_list.html:89
...
...
@@ -885,6 +884,7 @@ msgstr "快速修改"
#: assets/templates/assets/asset_list.html:37
#: assets/templates/assets/user_asset_list.html:25 perms/models.py:20
#: perms/templates/perms/asset_permission_create_update.html:47
#: perms/templates/perms/asset_permission_detail.html:116
#: terminal/templates/terminal/terminal_list.html:34
#: users/templates/users/_select_user_modal.html:18
#: users/templates/users/user_detail.html:127
...
...
@@ -925,10 +925,10 @@ msgid "Add assets to this group"
msgstr "添加资产到该组"
#: assets/templates/assets/asset_group_detail.html:79
#: perms/templates/perms/asset_permission_asset.html:
108
#: perms/templates/perms/asset_permission_asset.html:
97
#: perms/templates/perms/asset_permission_detail.html:153
#: perms/templates/perms/asset_permission_user.html:
108
#: perms/templates/perms/asset_permission_user.html:1
36
#: perms/templates/perms/asset_permission_user.html:
97
#: perms/templates/perms/asset_permission_user.html:1
25
#: users/templates/users/user_group_detail.html:95
msgid "Add"
msgstr "添加"
...
...
@@ -942,7 +942,7 @@ msgstr "移除"
msgid "Create asset group"
msgstr "创建资产组"
#: assets/templates/assets/asset_group_list.html:8
2
#: assets/templates/assets/asset_group_list.html:8
0
#: assets/templates/assets/asset_list.html:197
#: assets/templates/assets/cluster_list.html:84
#: assets/templates/assets/system_user_list.html:129
...
...
@@ -953,29 +953,29 @@ msgstr "创建资产组"
msgid "Are you sure?"
msgstr "你确认吗?"
#: assets/templates/assets/asset_group_list.html:8
3
#: assets/templates/assets/asset_group_list.html:8
1
#: users/templates/users/user_group_list.html:78
msgid "This will delete the selected groups !!!"
msgstr "删除选择组"
#: assets/templates/assets/asset_group_list.html:
91
#: assets/templates/assets/asset_group_list.html:
89
msgid "Group deleted"
msgstr "组已被删除"
#: assets/templates/assets/asset_group_list.html:9
2
#: assets/templates/assets/asset_group_list.html:9
7
#: assets/templates/assets/asset_group_list.html:9
0
#: assets/templates/assets/asset_group_list.html:9
5
msgid "Group Delete"
msgstr "删除"
#: assets/templates/assets/asset_group_list.html:9
6
#: assets/templates/assets/asset_group_list.html:9
4
msgid "Group deleting failed."
msgstr "删除失败"
#: assets/templates/assets/asset_group_list.html:15
9
#: assets/templates/assets/asset_group_list.html:15
7
msgid "The selected asset groups has been updated successfully."
msgstr "更新成功"
#: assets/templates/assets/asset_group_list.html:1
60
#: assets/templates/assets/asset_group_list.html:1
58
msgid "AssetGroup Updated"
msgstr "资产组更新"
...
...
@@ -1176,7 +1176,7 @@ msgstr "系统用户删除失败"
msgid "Connective"
msgstr "连接性"
#: assets/templates/assets/user_asset_list.html:6
6
#: assets/templates/assets/user_asset_list.html:6
5
msgid "Connect"
msgstr "连接"
...
...
@@ -1362,7 +1362,7 @@ msgid "Version detail"
msgstr "版本详情"
#: ops/templates/ops/adhoc_detail.html:22
#: ops/templates/ops/adhoc_history.html:22 ops/views.py:10
4
#: ops/templates/ops/adhoc_history.html:22 ops/views.py:10
5
msgid "Version run history"
msgstr "执行历史"
...
...
@@ -1434,7 +1434,7 @@ msgstr "失败/成功/总"
msgid "Version"
msgstr "版本"
#: ops/templates/ops/adhoc_history_detail.html:19 ops/views.py:11
7
#: ops/templates/ops/adhoc_history_detail.html:19 ops/views.py:11
8
msgid "Run history detail"
msgstr "执行历史详情"
...
...
@@ -1460,12 +1460,12 @@ msgid "Success assets"
msgstr "成功资产"
#: ops/templates/ops/task_adhoc.html:19 ops/templates/ops/task_detail.html:19
#: ops/templates/ops/task_history.html:19 ops/views.py:5
2
#: ops/templates/ops/task_history.html:19 ops/views.py:5
3
msgid "Task detail"
msgstr "任务详情"
#: ops/templates/ops/task_adhoc.html:22 ops/templates/ops/task_detail.html:22
#: ops/templates/ops/task_history.html:22 ops/views.py:6
5
#: ops/templates/ops/task_history.html:22 ops/views.py:6
6
msgid "Task versions"
msgstr "任务各版本"
...
...
@@ -1517,21 +1517,21 @@ msgstr "成功"
msgid "Date"
msgstr "日期"
#: ops/views.py:3
5 ops/views.py:51 ops/views.py:64 ops/views.py:77
#: ops/views.py:9
0 ops/views.py:103 ops/views.py:116
#: ops/views.py:3
6 ops/views.py:52 ops/views.py:65 ops/views.py:78
#: ops/views.py:9
1 ops/views.py:104 ops/views.py:117
msgid "Ops"
msgstr "作业中心"
#: ops/views.py:3
6
#: ops/views.py:3
7
msgid "Task list"
msgstr "任务列表"
#: ops/views.py:7
8
#: ops/views.py:7
9
msgid "Task run history"
msgstr "执行历史"
#: perms/forms.py:16 users/forms.py:144 users/forms.py:149 users/forms.py:161
#: users/forms.py:19
0
#: users/forms.py:19
1
msgid "Select users"
msgstr "选择用户"
...
...
@@ -1542,12 +1542,13 @@ msgstr "选择用户"
#: terminal/templates/terminal/command_list.html:32
#: terminal/templates/terminal/command_list.html:72
#: terminal/templates/terminal/session_list.html:33
#: terminal/templates/terminal/session_list.html:71 users/models/user.py:31
#: users/templates/users/user_group_detail.html:78 users/views/user.py:348
#: terminal/templates/terminal/session_list.html:71 users/forms.py:187
#: users/models/user.py:31 users/templates/users/user_group_detail.html:78
#: users/views/user.py:348
msgid "User"
msgstr "用户"
#: perms/forms.py:31 perms/templates/perms/asset_permission_user.html:1
27
#: perms/forms.py:31 perms/templates/perms/asset_permission_user.html:1
16
msgid "Select user groups"
msgstr "选择用户组"
...
...
@@ -1594,21 +1595,15 @@ msgstr "用户或用户组"
msgid "Assets and asset groups"
msgstr "资产或资产组"
#: perms/templates/perms/asset_permission_asset.html:57
#: perms/templates/perms/asset_permission_list.html:31
#: perms/templates/perms/asset_permission_user.html:57
msgid "Is valid"
msgstr "有效"
#: perms/templates/perms/asset_permission_asset.html:91
#: perms/templates/perms/asset_permission_asset.html:80
msgid "Add asset to this permission"
msgstr "添加资产"
#: perms/templates/perms/asset_permission_asset.html:1
19
#: perms/templates/perms/asset_permission_asset.html:1
08
msgid "Add asset group to this permission"
msgstr "添加资产组"
#: perms/templates/perms/asset_permission_asset.html:1
36
#: perms/templates/perms/asset_permission_asset.html:1
25
#: users/templates/users/user_detail.html:195
msgid "Join"
msgstr "加入"
...
...
@@ -1642,26 +1637,24 @@ msgstr "系统用户数量"
msgid "Create permission"
msgstr "创建授权规则"
#: perms/templates/perms/asset_permission_list.html:31
msgid "Is valid"
msgstr "有效"
#: perms/templates/perms/asset_permission_user.html:35
msgid "User list of "
msgstr "用户列表"
#: perms/templates/perms/asset_permission_user.html:56 users/models/user.py:37
#: users/templates/users/user_detail.html:70
#: users/templates/users/user_profile.html:59
msgid "Email"
msgstr "邮件"
#: perms/templates/perms/asset_permission_user.html:91
#: perms/templates/perms/asset_permission_user.html:80
msgid "Add user to asset permission"
msgstr "添加用户"
#: perms/templates/perms/asset_permission_user.html:
99
#: perms/templates/perms/asset_permission_user.html:
88
#: users/templates/users/login_log_list.html:28
msgid "Select user"
msgstr "选择用户"
#: perms/templates/perms/asset_permission_user.html:1
19
#: perms/templates/perms/asset_permission_user.html:1
08
msgid "Add user group to asset permission"
msgstr "添加用户组"
...
...
@@ -1782,8 +1775,8 @@ msgstr ""
msgid "Close"
msgstr "关闭"
#: templates/_nav.html:9 users/views/group.py:30 users/views/group.py:4
6
#: users/views/group.py:7
2 users/views/group.py:89
users/views/login.py:193
#: templates/_nav.html:9 users/views/group.py:30 users/views/group.py:4
8
#: users/views/group.py:7
4 users/views/group.py:91
users/views/login.py:193
#: users/views/login.py:242 users/views/user.py:55 users/views/user.py:70
#: users/views/user.py:95 users/views/user.py:151 users/views/user.py:308
#: users/views/user.py:322 users/views/user.py:366 users/views/user.py:388
...
...
@@ -1905,6 +1898,7 @@ msgid "Boot Time"
msgstr "运行时间"
#: terminal/models.py:96 terminal/templates/terminal/session_list.html:74
#: terminal/templates/terminal/terminal_detail.html:47
msgid "Remote addr"
msgstr "远端地址"
...
...
@@ -2166,6 +2160,11 @@ msgstr "管理员"
msgid "Application"
msgstr "应用程序"
#: users/models/user.py:37 users/templates/users/user_detail.html:70
#: users/templates/users/user_profile.html:59
msgid "Email"
msgstr "邮件"
#: users/models/user.py:39 users/templates/users/_select_user_modal.html:15
#: users/templates/users/user_detail.html:86
#: users/templates/users/user_list.html:25
...
...
@@ -2384,7 +2383,7 @@ msgstr "授权资产组"
msgid "Cancel"
msgstr "取消"
#: users/templates/users/user_group_detail.html:22 users/views/group.py:9
0
#: users/templates/users/user_group_detail.html:22 users/views/group.py:9
2
msgid "User group detail"
msgstr "资产组详情"
...
...
@@ -2396,7 +2395,7 @@ msgstr "添加用户"
msgid "Valid"
msgstr "可用"
#: users/templates/users/user_group_list.html:5 users/views/group.py:4
7
#: users/templates/users/user_group_list.html:5 users/views/group.py:4
9
msgid "Create user group"
msgstr "创建用户组"
...
...
@@ -2597,7 +2596,13 @@ msgstr "密码或秘钥不合法"
msgid "User group list"
msgstr "用户组列表"
#: users/views/group.py:73
#: users/views/group.py:43
#, fuzzy, python-brace-format
#| msgid "Create user <a href=\"{url}\">{name}</a> successfully."
msgid "User group <a href={url}> {name} </a> was created successfully"
msgstr "创建用户 <a href=\"{url}\">{name}</a> 成功"
#: users/views/group.py:75
msgid "Update user group"
msgstr "编辑用户组"
...
...
@@ -2683,14 +2688,4 @@ msgstr "密码更新"
msgid "Public key update"
msgstr "秘钥更新"
#~ msgid "Visit us"
#~ msgstr "访问官网"
#~ msgid "Audits"
#~ msgstr "审计中心"
#~ msgid "Proxy log list"
#~ msgstr "Session列表"
#~ msgid "If also set private key, use that first"
#~ msgstr "如果设置私钥,则优先使用密钥"
apps/ops/api.py
View file @
c0829194
...
...
@@ -2,11 +2,13 @@
from
django.shortcuts
import
get_object_or_404
from
rest_framework
import
viewsets
from
rest_framework
import
viewsets
,
generics
from
rest_framework.views
import
Response
from
.hands
import
IsSuperUser
from
.models
import
Task
,
AdHoc
,
AdHocRunHistory
from
.serializers
import
TaskSerializer
,
AdHocSerializer
,
AdHocRunHistorySerializer
from
.tasks
import
run_ansible_task
class
TaskViewSet
(
viewsets
.
ModelViewSet
):
...
...
@@ -15,6 +17,17 @@ class TaskViewSet(viewsets.ModelViewSet):
permission_classes
=
(
IsSuperUser
,)
class
TaskRun
(
generics
.
RetrieveAPIView
):
queryset
=
Task
.
objects
.
all
()
serializer_class
=
TaskViewSet
permission_classes
=
(
IsSuperUser
,)
def
retrieve
(
self
,
request
,
*
args
,
**
kwargs
):
task
=
self
.
get_object
()
run_ansible_task
.
delay
(
str
(
task
.
id
))
return
Response
({
"msg"
:
"start"
})
class
AdHocViewSet
(
viewsets
.
ModelViewSet
):
queryset
=
AdHoc
.
objects
.
all
()
serializer_class
=
AdHocSerializer
...
...
apps/ops/templates/ops/task_detail.html
View file @
c0829194
...
...
@@ -89,7 +89,7 @@
<td>
<b>
{% for task in object.latest_adhoc.tasks %}
{{ forloop.counter }}. {{ task.name }} : {{ task.action.module }}
<br/>
{{ forloop.counter }}. {{ task.name }} :
::
{{ task.action.module }}
<br/>
{% endfor %}
</b>
</td>
...
...
apps/ops/templates/ops/task_list.html
View file @
c0829194
...
...
@@ -67,6 +67,7 @@
{% endif %}
</td>
<td
class=
"text-center"
>
<a
data-uid=
"{{ object.id }}"
class=
"btn btn-xs btn-primary btn-run"
>
{% trans "Run" %}
</a>
<a
data-uid=
"{{ object.id }}"
class=
"btn btn-xs btn-danger btn-del"
>
{% trans "Delete" %}
</a>
</td>
</tr>
...
...
@@ -98,10 +99,32 @@ $(document).ready(function() {
}).
on
(
'click'
,
'.btn-del'
,
function
()
{
var
$this
=
$
(
this
);
var
name
=
$
(
this
)
.
closest
(
"tr"
).
find
(
":nth-child(2)"
).
children
(
'a'
).
html
();
var
name
=
$
this
.
closest
(
"tr"
).
find
(
":nth-child(2)"
).
children
(
'a'
).
html
();
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "api-ops:task-detail" pk=DEFAULT_PK %}'
.
replace
(
'{{ DEFAULT_PK }}'
,
uid
);
objectDelete
(
$this
,
name
,
the_url
);
}).
on
(
'click'
,
'.btn-run'
,
function
()
{
var
$this
=
$
(
this
);
var
name
=
$this
.
closest
(
"tr"
).
find
(
":nth-child(2)"
).
children
(
'a'
).
html
();
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "api-ops:task-run" pk=DEFAULT_PK %}'
.
replace
(
'{{ DEFAULT_PK }}'
,
uid
);
var
error
=
function
(
data
)
{
alert
(
data
)
};
var
success
=
function
()
{
setTimeout
(
function
()
{
console
.
log
(
"ok"
)
},
1000
);
window
.
location
=
"{% url 'ops:task-detail' pk=DEFAULT_PK %}"
.
replace
(
'{{ DEFAULT_PK }}'
,
uid
);
};
APIUpdateAttr
({
url
:
the_url
,
error
:
error
,
method
:
'GET'
,
success
:
success
,
success_message
:
"{% trans 'Task start: ' %}"
+
" "
+
name
});
})
</script>
{% endblock %}
...
...
apps/ops/urls/api_urls.py
View file @
c0829194
# ~*~ coding: utf-8 ~*~
from
__future__
import
unicode_literals
from
django.conf.urls
import
url
from
rest_framework.routers
import
DefaultRouter
from
..
import
api
...
...
@@ -12,6 +13,8 @@ router.register(r'v1/tasks', api.TaskViewSet, 'task')
router
.
register
(
r'v1/adhoc'
,
api
.
AdHocViewSet
,
'adhoc'
)
router
.
register
(
r'v1/history'
,
api
.
AdHocRunHistorySet
,
'history'
)
urlpatterns
=
[]
urlpatterns
=
[
url
(
r'^v1/tasks/(?P<pk>[0-9a-zA-Z\-]{36})/run/$'
,
api
.
TaskRun
.
as_view
(),
name
=
'task-run'
),
]
urlpatterns
+=
router
.
urls
apps/perms/templates/perms/asset_permission_detail.html
View file @
c0829194
...
...
@@ -27,11 +27,11 @@
<i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'Assets and asset groups' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'perms:asset-permission-update' pk=asset_permission.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'perms:asset-permission-update' pk=asset_permission.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-danger btn-delete-perm"
>
<i
class=
"fa fa-
edit"
></i>
Delete
<i
class=
"fa fa-
trash-o"
></i>
{% trans 'Delete' %}
</a>
</li>
</ul>
...
...
apps/terminal/templates/terminal/terminal_detail.html
View file @
c0829194
...
...
@@ -13,7 +13,7 @@
<a
href=
""
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Terminal detail' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'terminal:terminal-update' pk=terminal.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'terminal:terminal-update' pk=terminal.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
</ul>
</div>
...
...
apps/users/templates/users/user_detail.html
View file @
c0829194
...
...
@@ -22,11 +22,11 @@
<a
href=
"{% url 'users:user-granted-asset' pk=user_object.id %}"
class=
"text-center"
><i
class=
"fa fa-cubes"
></i>
{% trans 'Asset granted' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'users:user-update' pk=user_object.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'users:user-update' pk=user_object.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-danger btn-delete-user"
>
<i
class=
"fa fa-
edit"
></i>
Delete
<i
class=
"fa fa-
trash-o"
></i>
{% trans 'Delete' %}
</a>
</li>
</ul>
...
...
apps/users/templates/users/user_group_detail.html
View file @
c0829194
...
...
@@ -25,11 +25,11 @@
{#
<a
href=
"{% url 'users:user-group-granted-asset' pk=user_group.id %}"
class=
"text-center"
><i
class=
"fa fa-cubes"
></i>
{% trans 'Asset granted' %}
</a>
#}
{#
</li>
#}
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'users:user-group-update' pk=user_group.id %}"
><i
class=
"fa fa-edit"
></i>
Update
</a>
<a
class=
"btn btn-outline btn-default"
href=
"{% url 'users:user-group-update' pk=user_group.id %}"
><i
class=
"fa fa-edit"
></i>
{% trans 'Update' %}
</a>
</li>
<li
class=
"pull-right"
>
<a
class=
"btn btn-outline btn-danger btn-delete-user-group"
>
<i
class=
"fa fa-
edit"
></i>
Delete
<i
class=
"fa fa-
trash-o"
></i>
{% trans 'Delete' %}
</a>
</li>
</ul>
...
...
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