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
239dd056
Commit
239dd056
authored
Sep 08, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish admin user view
parent
ff30435e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
29 deletions
+62
-29
admin_user_create_update.html
apps/assets/templates/assets/admin_user_create_update.html
+0
-0
admin_user_detail.html
apps/assets/templates/assets/admin_user_detail.html
+0
-0
admin_user_list.html
apps/assets/templates/assets/admin_user_list.html
+1
-1
asset_group_detail.html
apps/assets/templates/assets/asset_group_detail.html
+19
-19
views.py
apps/assets/views.py
+40
-6
user_detail.html
apps/users/templates/users/user_detail.html
+2
-2
urls.py
apps/users/urls.py
+0
-1
No files found.
apps/assets/templates/assets/admin_user_create.html
→
apps/assets/templates/assets/admin_user_create
_update
.html
View file @
239dd056
File moved
apps/assets/templates/assets/admin_user_detail.html
0 → 100644
View file @
239dd056
This diff is collapsed.
Click to expand it.
apps/assets/templates/assets/admin_user_list.html
View file @
239dd056
...
...
@@ -20,7 +20,7 @@
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ admin_user.id }}
</td>
<td>
<a
href=
"{% url '
users:user-detail' pk=
user.id %}"
>
<a
href=
"{% url '
assets:admin-user-detail' pk=admin_
user.id %}"
>
{{ admin_user.name }}
</a>
</td>
...
...
apps/assets/templates/assets/asset_group_detail.html
View file @
239dd056
...
...
@@ -69,7 +69,7 @@
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span>
{% trans 'Asset list of ' %}
<b>
{{ asset_group.name }}
</b></span>
<span
style=
"float: left"
></span
>
{% trans 'Asset list of ' %}
<b>
{{ asset_group.name }}
</b></span>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
...
...
@@ -118,7 +118,7 @@
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Associate
asset user(system/admin)
' %}
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Associate
system user
' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
...
...
@@ -207,23 +207,23 @@
{% endblock %}
{% block custom_foot_js %}
<script>
function
switch_user_status
(
obj
)
{
var
status
=
$
(
obj
).
prop
(
'checked'
);
$
.
ajax
({
url
:
"{% url 'users:user-active-api' pk=user.id %}"
,
type
:
"PUT"
,
data
:
{
'is_active'
:
status
},
success
:
function
(
data
,
status
)
{
console
.
log
(
data
)
},
error
:
function
()
{
console
.
log
(
'error'
)
}
})
}
{
#
function
switch_user_status
(
obj
)
{
#
}
{
#
var
status
=
$
(
obj
).
prop
(
'checked'
);
#
}
{
##
}
{
#
$
.
ajax
({
#
}
{
#
url
:
"{% url 'users:user-active-api' pk=user.id %}"
,
#
}
{
#
type
:
"PUT"
,
#
}
{
#
data
:
{
#
}
{
#
'is_active'
:
status
#
}
{
#
},
#
}
{
#
success
:
function
(
data
,
status
)
{
#
}
{
#
console
.
log
(
data
)
#
}
{
#
},
#
}
{
#
error
:
function
()
{
#
}
{
#
console
.
log
(
'error'
)
#
}
{
#
}
#
}
{
#
})
#
}
{
#
}
#
}
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
();
})
...
...
apps/assets/views.py
View file @
239dd056
...
...
@@ -213,7 +213,7 @@ class AdminUserListView(AdminUserRequiredMixin, ListView):
return
super
(
AdminUserListView
,
self
)
.
get_context_data
(
**
kwargs
)
def
get_queryset
(
self
):
# Todo: Default
group
by lose asset connection num
# Todo: Default
order
by lose asset connection num
self
.
queryset
=
super
(
AdminUserListView
,
self
)
.
get_queryset
()
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
,
'-date_created'
)
...
...
@@ -230,7 +230,7 @@ class AdminUserListView(AdminUserRequiredMixin, ListView):
class
AdminUserCreateView
(
AdminUserRequiredMixin
,
SuccessMessageMixin
,
CreateView
):
model
=
AdminUser
form_class
=
AdminUserForm
template_name
=
'assets/admin_user_create.html'
template_name
=
'assets/admin_user_create
_update
.html'
success_url
=
reverse_lazy
(
'assets:admin-user-list'
)
success_message
=
_
(
'Create admin user <a href="
%
s">
%
s</a> successfully.'
)
...
...
@@ -250,12 +250,46 @@ class AdminUserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateVie
class
AdminUserUpdateView
(
AdminUserRequiredMixin
,
UpdateView
):
pass
model
=
AdminUser
form_class
=
AdminUserForm
template_name
=
'assets/admin_user_create_update.html'
success_message
=
_
(
'Update admin user <a href="
%
s">
%
s</a> successfully.'
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
'assets'
,
'action'
:
'Update admin user'
}
kwargs
.
update
(
context
)
return
super
(
AdminUserUpdateView
,
self
)
.
get_context_data
(
**
kwargs
)
class
AdminUserDetailView
(
AdminUserRequiredMixin
,
DetailView
):
pass
def
get_success_url
(
self
):
success_url
=
reverse_lazy
(
'assets:admin-user-detail'
,
pk
=
self
.
object
.
pk
)
return
success_url
class
AdminUserDetailView
(
AdminUserRequiredMixin
,
SingleObjectMixin
,
ListView
):
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
template_name
=
'assets/admin_user_detail.html'
context_object_name
=
'admin_user'
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
(
queryset
=
AdminUser
.
objects
.
all
())
return
super
(
AdminUserDetailView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
return
self
.
object
.
assets
.
all
()
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
'assets'
,
'action'
:
'Admin user detail'
}
kwargs
.
update
(
context
)
return
super
(
AdminUserDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
class
AdminUserDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
pass
model
=
AdminUser
template_name
=
'assets/delete_confirm.html'
success_url
=
'assets:admin-user-list'
apps/users/templates/users/user_detail.html
View file @
239dd056
...
...
@@ -108,7 +108,7 @@
<div
class=
"col-sm-5"
style=
"padding-left: 0;padding-right: 0"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick
modify
' %}
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick
update
' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
...
...
@@ -191,7 +191,7 @@
<tr>
<td
><b
class=
"bdg_user_group"
data-gid=
{{
group
.
id
}}
>
{{ group.name }}
</b></td>
<td>
<button
class=
"btn btn-danger btn-
sm
btn_delete_user_group"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
<button
class=
"btn btn-danger btn-
xs
btn_delete_user_group"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
{% endfor %}
...
...
apps/users/urls.py
View file @
239dd056
...
...
@@ -16,7 +16,6 @@ urlpatterns = [
name
=
'reset-password-success'
),
url
(
r'^user$'
,
views
.
UserListView
.
as_view
(),
name
=
'user-list'
),
url
(
r'^user/(?P<pk>[0-9]+)$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/(?P<pk>[0-9]+)/assets-perm$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/create$'
,
views
.
UserCreateView
.
as_view
(),
name
=
'user-create'
),
url
(
r'^user/(?P<pk>[0-9]+)/update$'
,
views
.
UserUpdateView
.
as_view
(),
name
=
'user-update'
),
url
(
r'^user/(?P<pk>[0-9]+)/delete$'
,
views
.
UserDeleteView
.
as_view
(),
name
=
'user-delete'
),
...
...
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