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
a0c9e3d1
Commit
a0c9e3d1
authored
Dec 13, 2016
by
yumaojun03
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加了部分sudo的页面
parent
3eb8a702
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
33 deletions
+25
-33
list.html
apps/ops/templates/sudo/list.html
+11
-21
api_urls.py
apps/ops/urls/api_urls.py
+9
-8
view_urls.py
apps/ops/urls/view_urls.py
+5
-4
No files found.
apps/ops/templates/sudo/list.html
View file @
a0c9e3d1
...
...
@@ -3,19 +3,20 @@
{% block table_search %}
{% endblock %}
{% block table_container %}
<div
class=
"uc pull-left m-l-5 m-r-5"
><a
href=
"{% url "
users:user-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create
user
" %}
</a></div>
<div
class=
"uc pull-left"
><a
href=
"javascript:void(0);"
class=
"btn btn-sm btn-primary"
data-toggle=
"modal"
data-target=
"#user_import_modal"
>
{% trans "Import user" %}
</a></div>
<div
class=
"uc pull-left m-l-5 m-r-5"
><a
href=
"{% url "
users:user-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create
sudo
" %}
</a></div>
{#
<div
class=
"uc pull-left"
><a
href=
"javascript:void(0);"
class=
"btn btnbtn-sm btn-primary"
data-toggle=
"modal"
data-target=
"#user_import_modal"
>
{% trans "Import user" %}
</a></div>
#}
<table
class=
"table table-striped table-bordered table-hover "
id=
"sudo_list_table"
>
<thead>
<tr>
<th
class=
"text-center"
>
{#
<div><input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
><label></label></div>
#}
<input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
>
</th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</th>
<th
class=
"text-center"
>
{% trans 'Privileges' %}
</th>
<th
class=
"text-center"
>
{% trans 'Extra Lines' %}
</th>
<th
class=
"text-center"
>
{% trans 'Created' %}
</th>
<th
class=
"text-center"
>
{% trans 'Action' %}
</th>
</tr>
</thead>
<tbody>
...
...
@@ -35,8 +36,8 @@
</div>
</div>
</div>
{
% include "users/_user_bulk_update_modal.html" %
}
{
% include "users/_user_import_modal.html" %
}
{
#{% include "users/_user_bulk_update_modal.html" %}#
}
{
#{% include "users/_user_import_modal.html" %}#
}
{% endblock %}
{% block content_bottom_left %}{% endblock %}
{% block custom_foot_js %}
...
...
@@ -47,21 +48,10 @@ $(document).ready(function(){
ele
:
$
(
'#sudo_list_table'
),
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
detail_btn
=
'<a href="{% url "
users:user
-detail" pk=99991937 %}">'
+
cellData
+
'</a>'
;
var
detail_btn
=
'<a href="{% url "
ops:page-sudo
-detail" pk=99991937 %}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'99991937'
,
rowData
.
id
));
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
var
innerHtml
=
cellData
.
length
>
20
?
cellData
.
substring
(
0
,
20
)
+
'...'
:
cellData
;
$
(
td
).
html
(
'<span href="javascript:void(0);" data-toggle="tooltip" title="'
+
cellData
+
'">'
+
innerHtml
+
'</span>'
);
}},
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
}
else
{
$
(
td
).
html
(
'<i class="fa fa-check text-navy"></i>'
)
}
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
5
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
var
update_btn
=
'<a href="{% url "users:user-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'99991937'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'
.
replace
(
'99991937'
,
cellData
);
if
(
rowData
.
id
===
1
||
rowData
.
username
==
"admin"
)
{
...
...
@@ -70,9 +60,9 @@ $(document).ready(function(){
$
(
td
).
html
(
update_btn
+
del_btn
)
}
}}],
ajax_url
:
'{% url "api-
users:user
-list" %}'
,
columns
:
[{
data
:
"id"
},
{
data
:
"
username"
},
{
data
:
"name"
},
{
data
:
"get_role_display
"
},
{
data
:
"
groups_display"
},
{
data
:
"is_valid
"
},
{
data
:
"id"
}],
ajax_url
:
'{% url "api-
ops:sudo
-list" %}'
,
columns
:
[{
data
:
"id"
},
{
data
:
"
name"
},
{
data
:
"privilege_items"
},
{
data
:
"extra_lines
"
},
{
data
:
"
created_time
"
},
{
data
:
"id"
}],
op_html
:
$
(
'#actions'
).
html
()
};
var
table
=
jumpserver
.
initDataTable
(
options
);
...
...
apps/ops/urls/api_urls.py
View file @
a0c9e3d1
...
...
@@ -7,13 +7,13 @@ from ops import api as v1_api
__all__
=
[
"urlpatterns"
]
api_router
=
DefaultRouter
()
api_router
.
register
(
r'host_alia'
,
v1_api
.
HostAliaViewSet
)
api_router
.
register
(
r'user_alia'
,
v1_api
.
UserAliaViewSet
)
api_router
.
register
(
r'cmd_alia'
,
v1_api
.
CmdAliaViewSet
)
api_router
.
register
(
r'runas_alia'
,
v1_api
.
RunasAliaViewSet
)
api_router
.
register
(
r'extra_conf'
,
v1_api
.
ExtraconfViewSet
)
api_router
.
register
(
r'privilege'
,
v1_api
.
PrivilegeViewSet
)
api_router
.
register
(
r'sudo'
,
v1_api
.
SudoViewSet
)
api_router
.
register
(
r'cron'
,
v1_api
.
CronTableViewSet
)
api_router
.
register
(
r'
v1/
host_alia'
,
v1_api
.
HostAliaViewSet
)
api_router
.
register
(
r'
v1/
user_alia'
,
v1_api
.
UserAliaViewSet
)
api_router
.
register
(
r'
v1/
cmd_alia'
,
v1_api
.
CmdAliaViewSet
)
api_router
.
register
(
r'
v1/
runas_alia'
,
v1_api
.
RunasAliaViewSet
)
api_router
.
register
(
r'
v1/
extra_conf'
,
v1_api
.
ExtraconfViewSet
)
api_router
.
register
(
r'
v1/
privilege'
,
v1_api
.
PrivilegeViewSet
)
api_router
.
register
(
r'
v1/
sudo'
,
v1_api
.
SudoViewSet
)
api_router
.
register
(
r'
v1/
cron'
,
v1_api
.
CronTableViewSet
)
urlpatterns
=
api_router
.
urls
\ No newline at end of file
apps/ops/urls/view_urls.py
View file @
a0c9e3d1
...
...
@@ -11,12 +11,12 @@ urlpatterns = [
# Resource Sudo url
url
(
r'^sudo/list$'
,
page_view
.
SudoListView
.
as_view
(),
name
=
'page-sudo-list'
),
url
(
r'^sudo/create$'
,
page_view
.
SudoCreateView
.
as_view
(),
name
=
'page-sudo-create'
),
url
(
r'^sudo/detail$'
,
page_view
.
SudoDetailView
.
as_view
(),
name
=
'page-sudo-detail'
),
url
(
r'^sudo/update$'
,
page_view
.
SudoUpdateView
.
as_view
(),
name
=
'page-sudo-update'
),
url
(
r'^sudo/
(?P<pk>[0-9]+)/
detail$'
,
page_view
.
SudoDetailView
.
as_view
(),
name
=
'page-sudo-detail'
),
url
(
r'^sudo/
(?P<pk>[0-9]+)/
update$'
,
page_view
.
SudoUpdateView
.
as_view
(),
name
=
'page-sudo-update'
),
# Resource Cron url
url
(
r'^cron/list$'
,
page_view
.
CronListView
.
as_view
(),
name
=
'page-cron-list'
),
url
(
r'^cron/create$'
,
page_view
.
CronCreateView
.
as_view
(),
name
=
'page-cron-create'
),
url
(
r'^cron/detail$'
,
page_view
.
CronDetailView
.
as_view
(),
name
=
'page-cron-detail'
),
url
(
r'^cron/update$'
,
page_view
.
CronUpdateView
.
as_view
(),
name
=
'page-cron-update'
),
url
(
r'^cron/
(?P<pk>[0-9]+)/
detail$'
,
page_view
.
CronDetailView
.
as_view
(),
name
=
'page-cron-detail'
),
url
(
r'^cron/
(?P<pk>[0-9]+)/
update$'
,
page_view
.
CronUpdateView
.
as_view
(),
name
=
'page-cron-update'
),
]
\ No newline at end of file
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