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
474f7e0f
Commit
474f7e0f
authored
Sep 30, 2016
by
江世峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of code.simcu.com:jumpserver/jumpserver
merge
parents
fd52a85d
d8143a67
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
333 additions
and
99 deletions
+333
-99
jumpserver.css
apps/static/css/jumpserver.css
+103
-7
jumpserver.js
apps/static/js/jumpserver.js
+12
-0
_modal.html
apps/templates/_modal.html
+1
-1
api.py
apps/users/api.py
+18
-6
serializers.py
apps/users/serializers.py
+2
-2
_select_user_modal.html
apps/users/templates/users/_select_user_modal.html
+23
-0
user_detail.html
apps/users/templates/users/user_detail.html
+2
-2
user_group_detail.html
apps/users/templates/users/user_group_detail.html
+153
-64
user_group_list.html
apps/users/templates/users/user_group_list.html
+1
-1
user_list.html
apps/users/templates/users/user_list.html
+13
-11
urls.py
apps/users/urls.py
+5
-5
No files found.
apps/static/css/jumpserver.css
View file @
474f7e0f
...
...
@@ -91,12 +91,108 @@ table.dataTable tbody td.selected td i.text-navy
color
:
white
;
}
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
.m-0
{
margin
:
0px
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
.m-t-0
{
margin-top
:
0px
!important
;
}
.m-b-0
{
margin-bottom
:
0px
!important
;
}
.m-l-0
{
margin-left
:
0px
!important
;
}
.m-r-0
{
margin-right
:
0px
!important
;
}
.m-5
{
margin
:
5px
!important
;
}
.m-t-5
{
margin-top
:
5px
!important
;
}
.m-b-5
{
margin-bottom
:
5px
!important
;
}
.m-l-5
{
margin-left
:
5px
!important
;
}
.m-r-5
{
margin-right
:
5px
!important
;
}
.m-10
{
margin
:
10px
!important
;
}
.m-t-10
{
margin-top
:
10px
!important
;
}
.m-b-10
{
margin-bottom
:
10px
!important
;
}
.m-l-10
{
margin-left
:
10px
!important
;
}
.m-r-10
{
margin-right
:
10px
!important
;
}
.m-15
{
margin
:
15px
!important
;
}
.m-t-15
{
margin-top
:
15px
!important
;
}
.m-b-15
{
margin-bottom
:
15px
!important
;
}
.m-l-15
{
margin-left
:
15px
!important
;
}
.m-r-15
{
margin-right
:
15px
!important
;
}
.m-20
{
margin
:
20px
!important
;
}
.m-t-20
{
margin-top
:
20px
!important
;
}
.m-b-20
{
margin-bottom
:
20px
!important
;
}
.m-l-20
{
margin-left
:
20px
!important
;
}
.m-r-20
{
margin-right
:
20px
!important
;
}
.m-25
{
margin
:
25px
!important
;
}
.m-t-25
{
margin-top
:
25px
!important
;
}
.m-b-25
{
margin-bottom
:
25px
!important
;
}
.m-l-25
{
margin-left
:
25px
!important
;
}
.m-r-25
{
margin-right
:
25px
!important
;
}
.m-30
{
margin
:
30px
!important
;
}
.m-t-30
{
margin-top
:
30px
!important
;
}
.m-b-30
{
margin-bottom
:
30px
!important
;
}
.m-l-30
{
margin-left
:
30px
!important
;
}
.m-r-30
{
margin-right
:
30px
!important
;
}
apps/static/js/jumpserver.js
View file @
474f7e0f
...
...
@@ -257,6 +257,7 @@ $.fn.serializeObject = function()
return
o
;
};
var
jumpserver
=
{};
jumpserver
.
checked
=
false
;
jumpserver
.
initDataTable
=
function
(
options
)
{
// options = {
// ele *: $('#dataTable_id'),
...
...
@@ -331,5 +332,16 @@ jumpserver.initDataTable = function (options) {
$
(
'#op'
).
html
(
options
.
op_html
||
''
);
$
(
'#uc'
).
html
(
options
.
uc_html
||
''
);
});
$
(
'.ipt_check_all'
).
on
(
'click'
,
function
()
{
if
(
!
jumpserver
.
checked
)
{
$
(
this
).
closest
(
'table'
).
find
(
'.ipt_check'
).
prop
(
'checked'
,
true
);
jumpserver
.
checked
=
true
;
table
.
rows
().
select
();
}
else
{
$
(
this
).
closest
(
'table'
).
find
(
'.ipt_check'
).
prop
(
'checked'
,
false
);
jumpserver
.
checked
=
false
;
table
.
rows
().
deselect
();
}
})
return
table
;
}
apps/templates/_modal.html
View file @
474f7e0f
{% load i18n %}
<div
aria-hidden=
"true"
role=
"dialog"
id=
"{% block modal_id %}{% endblock %}"
class=
"modal inmodal"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-dialog
{% block modal_class %}{% endblock %}
"
>
<div
class=
"modal-content animated fadeIn"
>
<div
class=
"modal-header"
>
<button
data-dismiss=
"modal"
class=
"close"
type=
"button"
><span
aria-hidden=
"true"
>
×
</span><span
class=
"sr-only"
>
Close
</span></button>
...
...
apps/users/api.py
View file @
474f7e0f
...
...
@@ -9,7 +9,7 @@ from rest_framework import generics, status
from
rest_framework.response
import
Response
from
rest_framework_bulk
import
ListBulkCreateUpdateDestroyAPIView
from
.serializers
import
UserSerializer
,
UserGroupSerializer
,
UserAttributeSerializer
,
UserGroup
EditSerializer
,
\
from
.serializers
import
UserSerializer
,
UserGroupSerializer
,
UserAttributeSerializer
,
GroupUser
EditSerializer
,
\
GroupEditSerializer
,
UserPKUpdateSerializer
,
UserBulkUpdateSerializer
from
.models
import
User
,
UserGroup
...
...
@@ -46,14 +46,14 @@ class UserAttributeApi(generics.RetrieveUpdateDestroyAPIView):
serializer_class
=
UserAttributeSerializer
class
UserGroup
EditApi
(
generics
.
RetrieveUpdateAPIView
):
class
GroupUser
EditApi
(
generics
.
RetrieveUpdateAPIView
):
queryset
=
User
.
objects
.
all
()
serializer_class
=
UserGroup
EditSerializer
serializer_class
=
GroupUser
EditSerializer
class
UserResetPasswordApi
(
generics
.
UpdateAPIView
):
queryset
=
User
.
objects
.
all
()
serializer_class
=
UserGroup
EditSerializer
serializer_class
=
GroupUser
EditSerializer
def
perform_update
(
self
,
serializer
):
# Note: we are not updating the user object here.
...
...
@@ -68,7 +68,7 @@ class UserResetPasswordApi(generics.UpdateAPIView):
class
UserResetPKApi
(
generics
.
UpdateAPIView
):
queryset
=
User
.
objects
.
all
()
serializer_class
=
UserGroup
EditSerializer
serializer_class
=
GroupUser
EditSerializer
def
perform_update
(
self
,
serializer
):
user
=
self
.
get_object
()
...
...
@@ -88,10 +88,22 @@ class UserUpdatePKApi(generics.UpdateAPIView):
user
.
save
()
class
Group
DeleteApi
(
generics
.
DestroyAPIView
):
class
Group
EditApi
(
generics
.
RetrieveUpdate
DestroyAPIView
):
queryset
=
UserGroup
.
objects
.
all
()
serializer_class
=
GroupEditSerializer
def
perform_update
(
self
,
serializer
):
users
=
serializer
.
validated_data
.
get
(
'users'
)
if
users
:
group
=
self
.
get_object
()
# Note: use `list` method to force hitting the db.
group_users
=
list
(
group
.
users
.
all
())
serializer
.
save
()
group
.
users
.
set
(
users
+
group_users
)
group
.
save
()
return
serializer
.
save
()
class
UserBulkUpdateApi
(
ListBulkCreateUpdateDestroyAPIView
):
queryset
=
User
.
objects
.
all
()
...
...
apps/users/serializers.py
View file @
474f7e0f
...
...
@@ -31,7 +31,7 @@ class GroupEditSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
UserGroup
fields
=
[
'id'
,
'name'
,
'comment'
,
'date_created'
,
'created_by'
]
fields
=
[
'id'
,
'name'
,
'comment'
,
'date_created'
,
'created_by'
,
'users'
]
class
UserAttributeSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -41,7 +41,7 @@ class UserAttributeSerializer(serializers.ModelSerializer):
fields
=
[
'avatar'
,
'wechat'
,
'phone'
,
'enable_otp'
,
'comment'
,
'is_active'
,
'name'
]
class
UserGroup
EditSerializer
(
serializers
.
ModelSerializer
):
class
GroupUser
EditSerializer
(
serializers
.
ModelSerializer
):
groups
=
serializers
.
PrimaryKeyRelatedField
(
many
=
True
,
queryset
=
UserGroup
.
objects
.
all
())
class
Meta
:
...
...
apps/users/templates/users/_select_user_modal.html
0 → 100644
View file @
474f7e0f
{% extends '_modal.html' %}
{% load i18n %}
{% block modal_class %}modal-lg{% endblock %}
{% block modal_id %}select_user_modal{% endblock %}
{% block modal_title%}{% trans "Please Select User" %}{% endblock %}
{% block modal_body %}
<table
class=
"table table-striped table-bordered table-hover "
id=
"select_user_table"
>
<thead>
<tr>
<th
class=
"text-center"
>
<div
class=
"checkbox checkbox-default"
><input
id=
""
type=
"checkbox"
class=
"ipt_check_all"
><label></label></div>
</th>
<th
class=
"text-center"
>
{% trans 'Name' %}
</a></th>
<th
class=
"text-center"
>
{% trans 'Username' %}
</a></th>
<th
class=
"text-center"
>
{% trans 'Role' %}
</th>
<th
class=
"text-center"
>
{% trans 'User group' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset num' %}
</th>
<th
class=
"text-center"
>
{% trans 'Active' %}
</a></th>
</tr>
</thead>
</table>
{% endblock %}
{% block modal_confirm_id %}btn_select_user{% endblock %}
apps/users/templates/users/user_detail.html
View file @
474f7e0f
...
...
@@ -222,7 +222,7 @@
jumpserver
.
selected_groups
=
{};
function
updateUserGroups
(
user_groups
)
{
var
the_url
=
"{% url 'users:
user-group
-edit-api' pk=user_object.id %}"
;
var
the_url
=
"{% url 'users:
group-user
-edit-api' pk=user_object.id %}"
;
var
body
=
{
id
:
{{
user_object
.
id
}},
groups
:
Object
.
assign
([],
user_groups
)
...
...
@@ -237,7 +237,7 @@ function updateUserGroups(user_groups) {
$
(
'.group_edit tbody'
).
append
(
'<tr>'
+
'<td><b class="bdg_user_group" data-gid="'
+
index
+
'">'
+
group_name
+
'</b></td>'
+
'<td><button class="btn btn-danger btn-
sm
pull-right btn_delete_user_group" type="button"><i class="fa fa-minus"></i></button></td>'
+
'<td><button class="btn btn-danger btn-
xs
pull-right btn_delete_user_group" type="button"><i class="fa fa-minus"></i></button></td>'
+
'</tr>'
)
});
...
...
apps/users/templates/users/user_group_detail.html
View file @
474f7e0f
...
...
@@ -5,18 +5,54 @@
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
sweetalert
/
sweetalert
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
dataTables
/
dataTables
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
awesome-bootstrap-checkbox
/
awesome-bootstrap-checkbox
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
select2
/
select2
.
full
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
plugins
/
sweetalert
/
sweetalert
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
plugins
/
dataTables
/
dataTables
.
min
.
js
"
%}"
></script>
<style>
.label
{
font-size
:
14px
;
line-height
:
2.5
;
.user_div
{
background-color
:
#d1dade
;
color
:
#5e5e5e
;
font-family
:
"Open Sans"
;
padding
:
3px
8px
;
text-shadow
:
none
;
}
.
label
.remove
{
.
user_div
.remove
{
color
:
#fff
;
}
.
label
span
{
.
user_div
span
{
color
:
#5e5e5e
;
}
dl
{
width
:
100%
;
overflow
:
hidden
;
padding
:
0
;
margin
:
10px
;
border-bottom
:
1px
solid
#e7eaec
;
}
dt
{
float
:
left
;
width
:
30%
;
padding
:
0
;
margin
:
0
}
dd
{
float
:
left
;
width
:
70%
;
padding
:
0
;
margin
:
0
}
#group_user_row
dt
{
border-bottom
:
1px
solid
#e7eaec
;
width
:
100%
;
margin-bottom
:
20px
;
}
#group_user_row
dd
{
width
:
100%
;
overflow
:
auto
;
}
</style>
{% endblock %}
...
...
@@ -47,29 +83,26 @@
</div>
</div>
<div
class=
"ibox-content"
>
<table
class=
"table"
>
<tbody>
<tr>
<td
width=
"20%"
>
{% trans 'Name' %}:
</td>
<td><b>
{{ object.name }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Comment' %}:
</td>
<td><b>
{{ object.comment }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Created at' %}:
</td>
<td><b>
{{ object.date_created }}
</b></td>
</tr>
<tr>
<td>
{% trans 'Users' %}:
</td>
<td
style=
"line-height: 2"
>
<dl>
<dt
width=
"20%"
>
{% trans 'Name' %}:
</dt>
<dd><b>
{{ object.name }}
</b></dd>
</dl>
<dl>
<dt>
{% trans 'Comment' %}:
</dt>
<dd><b>
{{ object.comment }}
</b></dd>
</dl>
<dl>
<dt>
{% trans 'Created at' %}:
</dt>
<dd><b>
{{ object.date_created }}
</b></dd>
</dl>
<dl
id=
"group_user_row"
>
<dt>
{% trans 'Users' %}:
</dt>
<dd
style=
"line-height: 2"
id=
"group_user_container"
>
{% for user in object.users.all %}
<
span
class=
"label m-l-xs"
><a
href=
"{{ user.get_absolute_url }}"
><span>
{{ user.name }}
</span></a><a
data-uid=
"{{ user.id }}"
class=
"btn_remove"
><i
class=
"remove fa fa-times-circle"
></i></a></span
>
<
div
class=
"col-sm-4 user_div"
><div
class=
"col-xs-9"
><a
href=
"{{ user.get_absolute_url }}"
><span>
{{ user.name }}
</span></a></div><div
class=
"col-xs-3"
><a
data-uid=
"{{ user.id }}"
class=
"btn_remove m-l-5"
><i
class=
"remove fa fa-times-circle"
></i></a></div></div
>
{% endfor %}
</td>
</tr>
</table>
</dd>
</dl>
</div>
</div>
</div>
...
...
@@ -81,43 +114,22 @@
<div
class=
"panel-body"
>
<table
class=
"table"
>
<tbody>
<tr
class=
"no-borders-tr"
>
<td
width=
"50%"
>
{% trans 'Active' %}:
</td>
<td><span
class=
"pull-right"
>
<div
class=
"switch"
>
<div
class=
"onoffswitch"
>
<input
type=
"checkbox"
{%
if
user_object
.
is_active
%}
checked
{%
endif
%}
class=
"onoffswitch-checkbox"
id=
"is_active"
>
<label
class=
"onoffswitch-label"
for=
"is_active"
>
<span
class=
"onoffswitch-inner"
></span>
<span
class=
"onoffswitch-switch"
></span>
</label>
</div>
</div>
</span></td>
</tr>
<tr>
<td>
{% trans 'Enable OTP' %}:
</td>
<td><span
class=
"pull-right"
>
<div
class=
"switch"
>
<div
class=
"onoffswitch"
>
<input
type=
"checkbox"
class=
"onoffswitch-checkbox"
{%
if
user_object
.
enable_otp
%}
checked
{%
endif
%}
id=
"enable_otp"
>
<label
class=
"onoffswitch-label"
for=
"enable_otp"
>
<span
class=
"onoffswitch-inner"
></span>
<span
class=
"onoffswitch-switch"
></span>
</label>
</div>
</div>
</span></td>
</tr>
<tr>
<td>
{% trans 'Reset password' %}:
</td>
<td>
<span
class=
"pull-right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
id=
"btn_reset_password"
style=
"width: 54px"
>
{% trans 'Reset' %}
</button>
</span>
</td>
</tr>
<tr>
<td>
{% trans 'Add User' %}:
</td>
<td>
<span
class=
"pull-right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
id=
"btn_group_add_user"
style=
"width: 54px"
data-toggle=
"modal"
data-target=
"#select_user_modal"
>
{% trans 'Add' %}
</button>
</span>
</td>
</tr>
<tr>
<td>
{% trans 'Delete' %}:
</td>
<td>
<span
class=
"pull-right"
>
<button
type=
"button"
class=
"btn btn-danger btn-xs"
id=
"btn_group_delete"
style=
"width: 54px"
>
{% trans 'Delete' %}
</button>
</span>
</td>
</tr>
</tbody>
</table>
</div>
...
...
@@ -128,6 +140,7 @@
</div>
</div>
</div>
{% include "users/_select_user_modal.html" %}
{% endblock %}
{% block custom_foot_js %}
<script>
...
...
@@ -136,11 +149,87 @@ $(document).on('click', '.btn_remove', function(){
var
uid
=
$this
.
data
(
'uid'
);
var
the_url
=
'{% url "users:delete-user-from-group-api" pk=object.id uid=99991937 %}'
.
replace
(
'99991937'
,
uid
);
var
success
=
function
(){
$this
.
closest
(
'.
label
'
).
remove
();
$this
.
closest
(
'.
user_div
'
).
remove
();
};
var
error
=
function
(){};
APIUpdateAttr
({
url
:
the_url
,
body
:
"{}"
,
method
:
"DELETE"
,
success
:
success
,
error
:
error
});
return
false
;
}).
on
(
'click'
,
'#btn_group_delete'
,
function
()
{
function
doDelete
()
{
var
the_url
=
'{% url "users:user-group-detail-api" pk=object.id %}'
;
var
success
=
function
()
{
window
.
location
.
href
=
'{% url "users:user-group-list" %}'
;
};
APIUpdateAttr
({
url
:
the_url
,
body
:
"{}"
,
method
:
"DELETE"
,
success
:
success
});
}
swal
({
title
:
"{% trans 'Are you sure?' %}"
,
text
:
"{% trans 'This will delete the current group, but will not delete any user of it.' %}"
,
type
:
"warning"
,
showCancelButton
:
true
,
confirmButtonColor
:
"#DD6B55"
,
confirmButtonText
:
"{% trans 'Confirm' %}"
,
closeOnConfirm
:
false
},
function
()
{
doDelete
();
});
}).
on
(
'shown.bs.modal'
,
'#select_user_modal'
,
function
()
{
if
(
$
.
fn
.
dataTable
.
isDataTable
(
'#select_user_table'
))
{
return
true
;
}
var
options
=
{
ele
:
$
(
'#select_user_table'
),
pageLength
:
10
,
buttons
:
[],
columnDefs
:
[
{
targets
:
6
,
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>'
)
}
}},
],
ajax_url
:
'{% url "users:user-bulk-update-api" %}'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"username"
},
{
data
:
"name"
},
{
data
:
"get_role_display"
},
{
data
:
"group_display"
},
{
data
:
function
(){
return
999
}},
{
data
:
"active_display"
}],
};
jumpserver
.
initDataTable
(
options
);
}).
on
(
'click'
,
'#btn_select_user'
,
function
()
{
var
$data_table
=
$
(
'#select_user_table'
).
DataTable
();
var
plain_id_list
=
[];
var
selected_users
=
[];
$data_table
.
rows
({
selected
:
true
}).
every
(
function
(){
plain_id_list
.
push
(
this
.
data
().
id
);
selected_users
.
push
({
id
:
this
.
data
().
id
,
name
:
this
.
data
().
name
});
});
console
.
log
(
selected_users
)
if
(
plain_id_list
===
[])
{
return
false
;
};
var
body
=
{
id
:
{{
object
.
id
}},
users
:
plain_id_list
.
map
(
Number
)
};
$
(
'#select_user_modal'
).
modal
(
'hide'
);
var
the_url
=
"{% url 'users:user-group-edit-api' pk=object.id %}"
;
var
success
=
function
()
{
toastr
.
success
(
'{% trans "The selected users has been added to current group." %}'
);
var
html
=
""
;
$
.
each
(
selected_users
,
function
(
index
,
user
)
{
html
+=
[
'<div class="col-sm-4 user_div"><div class="col-xs-9"><a href="'
,
'{% url "users:user-detail" pk=99991937 %}'
.
replace
(
99991937
,
user
.
id
),
'"><span>'
,
user
.
name
,
'</span></a></div><div class="col-xs-3"><a data-uid="'
,
user
.
id
,
'" class="btn_remove m-l-5"><i class="remove fa fa-times-circle"></i></a></div></div>
\
n'
,
].
join
(
""
);
});
$
(
html
).
appendTo
(
$
(
'#group_user_container'
));
}
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success
:
success
});
})
</script>
{% endblock %}
apps/users/templates/users/user_group_list.html
View file @
474f7e0f
...
...
@@ -65,7 +65,7 @@ $(document).on('click', '.btn_delete_user_group', function(){
var
$this
=
$
(
this
);
function
doDelete
()
{
var
group_id
=
$this
.
data
(
'gid'
);
var
the_url
=
"{% url 'users:user-group-
delete
-api' 99991937 %}"
.
replace
(
'99991937'
,
group_id
);
var
the_url
=
"{% url 'users:user-group-
edit
-api' 99991937 %}"
.
replace
(
'99991937'
,
group_id
);
var
body
=
{};
var
success
=
function
()
{
var
msg
=
"{% trans 'Group Deleted.' %}"
;
...
...
apps/users/templates/users/user_list.html
View file @
474f7e0f
...
...
@@ -2,6 +2,19 @@
{% load i18n static %}
{% get_current_language as LANGUAGE_CODE %}
{% load common_tags %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div
.dataTables_wrapper
div
.dataTables_filter
,
.dataTables_length
{
float
:
right
!important
;
}
div
.dataTables_wrapper
div
.dataTables_filter
{
margin-left
:
15px
;
}
</style>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div
class=
"uc pull-left"
><a
href=
"{% url "
users:user-create
"
%}"
class=
"btn btn-sm btn-primary"
>
{% trans "Create user" %}
</a></div>
...
...
@@ -43,7 +56,6 @@
{% endblock %}
{% block custom_foot_js %}
<script>
jumpserver
.
checked
=
false
;
$
(
document
).
ready
(
function
(){
var
options
=
{
ele
:
$
(
'#user_list_table'
),
...
...
@@ -169,16 +181,6 @@ $(document).ready(function(){
},
function
()
{
doDelete
();
});
}).
on
(
'click'
,
'.ipt_check_all'
,
function
(){
if
(
!
jumpserver
.
checked
)
{
$
(
this
).
closest
(
'table'
).
find
(
'.ipt_check'
).
prop
(
'checked'
,
true
);
jumpserver
.
checked
=
true
;
$
(
'#user_list_table'
).
DataTable
().
rows
().
select
();
}
else
{
$
(
this
).
closest
(
'table'
).
find
(
'.ipt_check'
).
prop
(
'checked'
,
false
);
jumpserver
.
checked
=
false
;
$
(
'#user_list_table'
).
DataTable
().
rows
().
deselect
();
}
}).
on
(
'click'
,
'#btn_user_bulk_update'
,
function
(){
var
json_data
=
$
(
'#fm_user_bulk_update'
).
serializeObject
();
var
body
=
{};
...
...
apps/users/urls.py
View file @
474f7e0f
...
...
@@ -46,10 +46,10 @@ urlpatterns += [
url
(
r'^v1/user-groups$'
,
api
.
UserGroupListAddApi
.
as_view
(),
name
=
'user-group-list-api'
),
url
(
r'^v1/user-groups/(?P<pk>[0-9]+)$'
,
api
.
UserGroupDetailDeleteUpdateApi
.
as_view
(),
name
=
'user-group-detail-api'
),
url
(
r'^v1/user-groups/
group/
(?P<pk>\d+)/user/(?P<uid>\d+)/$'
,
url
(
r'^v1/user-groups/(?P<pk>\d+)/user/(?P<uid>\d+)/$'
,
api
.
DeleteUserFromGroupApi
.
as_view
(),
name
=
'delete-user-from-group-api'
),
url
(
r'^v1/user-groups/(?P<pk>[0-9]+)/
edit
$'
,
api
.
UserGroupEditApi
.
as_view
(),
name
=
'user-group
-edit-api'
),
url
(
r'^v1/user-groups/(?P<pk>[0-9]+)/
delete/$'
,
api
.
GroupDelete
Api
.
as_view
(),
name
=
'user-group-
delete
-api'
),
url
(
r'^v1/user-groups/(?P<pk>[0-9]+)/
users/
$'
,
api
.
GroupUserEditApi
.
as_view
(),
name
=
'group-user
-edit-api'
),
url
(
r'^v1/user-groups/(?P<pk>[0-9]+)/
edit/$'
,
api
.
GroupEdit
Api
.
as_view
(),
name
=
'user-group-
edit
-api'
),
]
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