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
19051d36
Commit
19051d36
authored
Dec 01, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改一些bug
parent
7910292e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
77 deletions
+34
-77
asset_list.html
apps/assets/templates/assets/asset_list.html
+0
-7
user_list.html
apps/users/templates/users/user_list.html
+6
-6
views_urls.py
apps/users/urls/views_urls.py
+26
-61
group.py
apps/users/views/group.py
+2
-3
No files found.
apps/assets/templates/assets/asset_list.html
View file @
19051d36
...
@@ -5,12 +5,6 @@
...
@@ -5,12 +5,6 @@
<link
href=
"{% static 'css/plugins/select2/select2.min.css' %}"
rel=
"stylesheet"
>
<link
href=
"{% static 'css/plugins/select2/select2.min.css' %}"
rel=
"stylesheet"
>
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
{#
<style>
#}
{
#
.custom{#
}
{
#
margin-right
:
5px
;
#
}
{
#
}
#}
{
#
#modal
.modal-body
{
max-height
:
200px
;
}
#}
{
#
</style>
#}
{% endblock %}
{% endblock %}
{% block content_left_head %}{% endblock %}
{% block content_left_head %}{% endblock %}
...
@@ -27,7 +21,6 @@
...
@@ -27,7 +21,6 @@
</div>
</div>
{% endblock %}
{% endblock %}
{% block table_container %}
{% block table_container %}
<div
class=
"uc pull-left m-l-5 m-r-5"
><a
href=
"{% url "
assets:asset-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create asset" %}
</a></div>
<div
class=
"uc pull-left m-l-5 m-r-5"
><a
href=
"{% url "
assets:asset-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create asset" %}
</a></div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"asset_list_table"
>
<table
class=
"table table-striped table-bordered table-hover "
id=
"asset_list_table"
>
...
...
apps/users/templates/users/user_list.html
View file @
19051d36
...
@@ -74,8 +74,8 @@ function renderTable() {
...
@@ -74,8 +74,8 @@ function renderTable() {
ele
:
$
(
'#user_list_table'
),
ele
:
$
(
'#user_list_table'
),
columnDefs
:
[
columnDefs
:
[
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
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 "users:user-detail" pk=
'
00000000
-
0000
-
0000
-
0000
-
000000000000
'
%}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'
99991937
'
,
rowData
.
id
));
$
(
td
).
html
(
detail_btn
.
replace
(
'
00000000-0000-0000-0000-000000000000
'
,
rowData
.
id
));
}},
}},
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
{
targets
:
4
,
createdCell
:
function
(
td
,
cellData
)
{
var
innerHtml
=
cellData
.
length
>
20
?
cellData
.
substring
(
0
,
20
)
+
'...'
:
cellData
;
var
innerHtml
=
cellData
.
length
>
20
?
cellData
.
substring
(
0
,
20
)
+
'...'
:
cellData
;
...
@@ -89,9 +89,9 @@ function renderTable() {
...
@@ -89,9 +89,9 @@ function renderTable() {
}
}
}},
}},
{
targets
:
6
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
targets
:
6
,
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
update_btn
=
'<a href="{% url "users:user-update" pk=
'
00000000
-
0000
-
0000
-
0000
-
000000000000
' %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
.
replace
(
'00000000-0000-0000-0000-000000000000
'
,
cellData
);
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="
99991937
" data-name="99991938">{% trans "Delete" %}</a>'
var
del_btn
=
'<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="
00000000-0000-0000-0000-000000000000
" data-name="99991938">{% trans "Delete" %}</a>'
.
replace
(
'
99991937
'
,
cellData
)
.
replace
(
'
00000000-0000-0000-0000-000000000000
'
,
cellData
)
.
replace
(
'99991938'
,
rowData
.
name
);
.
replace
(
'99991938'
,
rowData
.
name
);
if
(
rowData
.
id
===
1
||
rowData
.
username
==
"admin"
)
{
if
(
rowData
.
id
===
1
||
rowData
.
username
==
"admin"
)
{
$
(
td
).
html
(
update_btn
)
$
(
td
).
html
(
update_btn
)
...
@@ -230,7 +230,7 @@ $(document).ready(function(){
...
@@ -230,7 +230,7 @@ $(document).ready(function(){
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
var
name
=
$this
.
data
(
'name'
);
var
name
=
$this
.
data
(
'name'
);
var
uid
=
$this
.
data
(
'uid'
);
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "api-users:user-detail" pk=
99991937 %}'
.
replace
(
'99991937
'
,
uid
);
var
the_url
=
'{% url "api-users:user-detail" pk=
'
00000000
-
0000
-
0000
-
0000
-
000000000000
' %}'
.
replace
(
'00000000-0000-0000-0000-000000000000
'
,
uid
);
objectDelete
(
$this
,
name
,
the_url
);
objectDelete
(
$this
,
name
,
the_url
);
})
})
</script>
</script>
...
...
apps/users/urls/views_urls.py
View file @
19051d36
...
@@ -10,72 +10,37 @@ urlpatterns = [
...
@@ -10,72 +10,37 @@ urlpatterns = [
# Login view
# Login view
url
(
r'^login$'
,
views
.
UserLoginView
.
as_view
(),
name
=
'login'
),
url
(
r'^login$'
,
views
.
UserLoginView
.
as_view
(),
name
=
'login'
),
url
(
r'^logout$'
,
views
.
UserLogoutView
.
as_view
(),
name
=
'logout'
),
url
(
r'^logout$'
,
views
.
UserLogoutView
.
as_view
(),
name
=
'logout'
),
url
(
r'^password/forgot$'
,
views
.
UserForgotPasswordView
.
as_view
(),
url
(
r'^password/forgot$'
,
views
.
UserForgotPasswordView
.
as_view
(),
name
=
'forgot-password'
),
name
=
'forgot-password'
),
url
(
r'^password/forgot/sendmail-success$'
,
views
.
UserForgotPasswordSendmailSuccessView
.
as_view
(),
name
=
'forgot-password-sendmail-success'
),
url
(
r'^password/forgot/sendmail-success$'
,
url
(
r'^password/reset$'
,
views
.
UserResetPasswordView
.
as_view
(),
name
=
'reset-password'
),
views
.
UserForgotPasswordSendmailSuccessView
.
as_view
(),
url
(
r'^password/reset/success$'
,
views
.
UserResetPasswordSuccessView
.
as_view
(),
name
=
'reset-password-success'
),
name
=
'forgot-password-sendmail-success'
),
url
(
r'^password/reset$'
,
views
.
UserResetPasswordView
.
as_view
(),
name
=
'reset-password'
),
url
(
r'^password/reset/success$'
,
views
.
UserResetPasswordSuccessView
.
as_view
(),
name
=
'reset-password-success'
),
# Profile
# Profile
url
(
r'^profile/$'
,
views
.
UserProfileView
.
as_view
(),
url
(
r'^profile/$'
,
views
.
UserProfileView
.
as_view
(),
name
=
'user-profile'
),
name
=
'user-profile'
),
url
(
r'^profile/update/$'
,
views
.
UserProfileUpdateView
.
as_view
(),
name
=
'user-profile-update'
),
url
(
r'^profile/update/$'
,
views
.
UserProfileUpdateView
.
as_view
(),
url
(
r'^profile/password/update/$'
,
views
.
UserPasswordUpdateView
.
as_view
(),
name
=
'user-password-update'
),
name
=
'user-profile-update'
),
url
(
r'^profile/pubkey/update/$'
,
views
.
UserPublicKeyUpdateView
.
as_view
(),
name
=
'user-pubkey-update'
),
url
(
r'^profile/password/update/$'
,
views
.
UserPasswordUpdateView
.
as_view
(),
name
=
'user-password-update'
),
url
(
r'^profile/pubkey/update/$'
,
views
.
UserPublicKeyUpdateView
.
as_view
(),
name
=
'user-pubkey-update'
),
# User view
# User view
url
(
r'^user$'
,
views
.
UserListView
.
as_view
(),
name
=
'user-list'
),
url
(
r'^user$'
,
views
.
UserListView
.
as_view
(),
name
=
'user-list'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)$'
,
views
.
UserDetailView
.
as_view
(),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
name
=
'user-detail'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission$'
,
views
.
UserAssetPermissionView
.
as_view
(),
name
=
'user-asset-permission'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission$'
,
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission/create$'
,
views
.
UserAssetPermissionCreateView
.
as_view
(),
name
=
'user-asset-permission-create'
),
views
.
UserAssetPermissionView
.
as_view
(),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/assets'
,
views
.
UserGrantedAssetView
.
as_view
(),
name
=
'user-granted-asset'
),
name
=
'user-asset-permission'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/login-history'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-login-history'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission/create$'
,
url
(
r'^user/export/'
,
views
.
UserExportView
.
as_view
(),
name
=
'user-export'
),
views
.
UserAssetPermissionCreateView
.
as_view
(),
url
(
r'^first-login/$'
,
views
.
UserFirstLoginView
.
as_view
(),
name
=
'user-first-login'
),
name
=
'user-asset-permission-create'
),
url
(
r'^user/import/$'
,
views
.
UserBulkImportView
.
as_view
(),
name
=
'user-import'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/assets'
,
url
(
r'^user/create$'
,
views
.
UserCreateView
.
as_view
(),
name
=
'user-create'
),
views
.
UserGrantedAssetView
.
as_view
(),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]{36})/update$'
,
views
.
UserUpdateView
.
as_view
(),
name
=
'user-update'
),
name
=
'user-granted-asset'
),
url
(
r'^user/update$'
,
views
.
UserBulkUpdateView
.
as_view
(),
name
=
'user-bulk-update'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/login-history'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-login-history'
),
url
(
r'^user/export/'
,
views
.
UserExportView
.
as_view
(),
name
=
'user-export'
),
url
(
r'^first-login/$'
,
views
.
UserFirstLoginView
.
as_view
(),
name
=
'user-first-login'
),
url
(
r'^user/import/$'
,
views
.
UserBulkImportView
.
as_view
(),
name
=
'user-import'
),
url
(
r'^user/create$'
,
views
.
UserCreateView
.
as_view
(),
name
=
'user-create'
),
url
(
r'^user/(?P<pk>[0-9a-zA-Z\-]+)/update$'
,
views
.
UserUpdateView
.
as_view
(),
name
=
'user-update'
),
url
(
r'^user/update$'
,
views
.
UserBulkUpdateView
.
as_view
(),
name
=
'user-bulk-update'
),
# User group view
# User group view
url
(
r'^user-group$'
,
views
.
UserGroupListView
.
as_view
(),
url
(
r'^user-group$'
,
views
.
UserGroupListView
.
as_view
(),
name
=
'user-group-list'
),
name
=
'user-group-list'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)$'
,
views
.
UserGroupDetailView
.
as_view
(),
name
=
'user-group-detail'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)$'
,
views
.
UserGroupDetailView
.
as_view
(),
url
(
r'^user-group/create$'
,
views
.
UserGroupCreateView
.
as_view
(),
name
=
'user-group-create'
),
name
=
'user-group-detail'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/update$'
,
views
.
UserGroupUpdateView
.
as_view
(),
name
=
'user-group-update'
),
url
(
r'^user-group/create$'
,
views
.
UserGroupCreateView
.
as_view
(),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission$'
,
views
.
UserGroupAssetPermissionView
.
as_view
(),
name
=
'user-group-asset-permission'
),
name
=
'user-group-create'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission/create$'
,
views
.
UserGroupAssetPermissionCreateView
.
as_view
(),
name
=
'user-group-asset-permission-create'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/update$'
,
views
.
UserGroupUpdateView
.
as_view
(),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/assets'
,
views
.
UserGroupGrantedAssetView
.
as_view
(),
name
=
'user-group-granted-asset'
),
name
=
'user-group-update'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission$'
,
views
.
UserGroupAssetPermissionView
.
as_view
(),
name
=
'user-group-asset-permission'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/asset-permission/create$'
,
views
.
UserGroupAssetPermissionCreateView
.
as_view
(),
name
=
'user-group-asset-permission-create'
),
url
(
r'^user-group/(?P<pk>[0-9a-zA-Z\-]+)/assets'
,
views
.
UserGroupGrantedAssetView
.
as_view
(),
name
=
'user-group-granted-asset'
),
]
]
apps/users/views/group.py
View file @
19051d36
...
@@ -162,14 +162,13 @@ class UserGroupAssetPermissionCreateView(AdminUserRequiredMixin, CreateView):
...
@@ -162,14 +162,13 @@ class UserGroupAssetPermissionCreateView(AdminUserRequiredMixin, CreateView):
class
UserGroupGrantedAssetView
(
AdminUserRequiredMixin
,
DetailView
):
class
UserGroupGrantedAssetView
(
AdminUserRequiredMixin
,
DetailView
):
model
=
User
model
=
User
Group
template_name
=
'users/user_group_granted_asset.html'
template_name
=
'users/user_group_granted_asset.html'
context_object_name
=
'user_group'
context_object_name
=
'user_group'
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
(
queryset
=
UserGroup
.
objects
.
all
())
self
.
object
=
self
.
get_object
(
queryset
=
UserGroup
.
objects
.
all
())
return
super
(
UserGroupGrantedAssetView
,
self
)
\
return
super
()
.
get
(
request
,
*
args
,
**
kwargs
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
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