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
a2ede31a
Commit
a2ede31a
authored
Mar 15, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ȩʼ
parent
f3ae7f00
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
234 additions
and
115 deletions
+234
-115
views.py
jperm/views.py
+5
-0
jumpserver.conf
jumpserver.conf
+1
-1
api.py
jumpserver/api.py
+48
-27
views.py
jumpserver/views.py
+2
-22
urls.py
juser/urls.py
+2
-2
views.py
juser/views.py
+45
-12
dept_perm_list.html
templates/jperm/dept_perm_list.html
+2
-2
perm_list.html
templates/jperm/perm_list.html
+1
-1
sudo_cmd_list.html
templates/jperm/sudo_cmd_list.html
+2
-2
dept_detail.html
templates/juser/dept_detail.html
+100
-26
dept_list.html
templates/juser/dept_list.html
+8
-2
group_list.html
templates/juser/group_list.html
+1
-2
nav.html
templates/nav.html
+10
-9
paginator_new..html
templates/paginator_new..html
+7
-7
No files found.
jperm/views.py
View file @
a2ede31a
...
...
@@ -227,6 +227,9 @@ def sudo_ldap_add(name, users_runas, user_groups_select, asset_groups_select,
user_groups_select_list
,
asset_groups_select_list
,
cmd_groups_select_list
=
\
user_asset_cmd_groups_get
(
user_groups_select
,
asset_groups_select
,
cmd_groups_select
)
if
not
LDAP_ENABLE
:
return
True
users
=
[]
assets
=
[]
cmds
=
[]
...
...
@@ -283,6 +286,7 @@ def sudo_add(request):
cmd_groups_select
=
request
.
POST
.
getlist
(
'cmd_groups_select'
)
comment
=
request
.
POST
.
get
(
'comment'
,
''
)
if
LDAP_ENABLE
:
sudo_db_add
(
name
,
users_runas
,
user_groups_select
,
asset_groups_select
,
cmd_groups_select
,
comment
)
sudo_ldap_add
(
name
,
users_runas
,
user_groups_select
,
asset_groups_select
,
cmd_groups_select
)
...
...
@@ -335,6 +339,7 @@ def sudo_edit(request):
sudo_perm
=
SudoPerm
.
objects
.
get
(
id
=
sudo_perm_id
)
old_name
=
sudo_perm
.
name
if
LDAP_ENABLE
:
sudo_db_update
(
sudo_perm_id
,
name
,
users_runas
,
user_groups_select
,
asset_groups_select
,
cmd_groups_select
,
comment
)
sudo_ldap_add
(
name
,
users_runas
,
user_groups_select
,
asset_groups_select
,
...
...
jumpserver.conf
View file @
a2ede31a
...
...
@@ -8,7 +8,7 @@ password = mysql234
database
=
jumpserver
[
ldap
]
ldap_enable
=
0
ldap_enable
=
1
host_url
=
ldap
://
127
.
0
.
0
.
1
:
389
base_dn
=
dc
=
jumpserver
,
dc
=
org
root_dn
=
cn
=
admin
,
dc
=
jumpserver
,
dc
=
org
...
...
jumpserver/api.py
View file @
a2ede31a
...
...
@@ -9,6 +9,7 @@ from Crypto.Cipher import AES
from
binascii
import
b2a_hex
,
a2b_hex
import
ldap
from
ldap
import
modlist
import
hashlib
from
django.http
import
HttpResponse
,
Http404
...
...
@@ -25,33 +26,7 @@ SSH_KEY_DIR = os.path.join(BASE_DIR, 'keys')
SERVER_KEY_DIR
=
os
.
path
.
join
(
SSH_KEY_DIR
,
'server'
)
KEY
=
CONF
.
get
(
'web'
,
'key'
)
LOGIN_NAME
=
getpass
.
getuser
()
class
PyCrypt
(
object
):
"""This class used to encrypt and decrypt password."""
def
__init__
(
self
,
key
):
self
.
key
=
key
self
.
mode
=
AES
.
MODE_CBC
def
encrypt
(
self
,
text
):
cryptor
=
AES
.
new
(
self
.
key
,
self
.
mode
,
b
'0000000000000000'
)
length
=
16
try
:
count
=
len
(
text
)
except
TypeError
:
raise
ServerError
(
'Encrypt password error, TYpe error.'
)
add
=
(
length
-
(
count
%
length
))
text
+=
(
'
\0
'
*
add
)
ciphertext
=
cryptor
.
encrypt
(
text
)
return
b2a_hex
(
ciphertext
)
CRYPTOR
=
PyCrypt
(
KEY
)
class
ServerError
(
Exception
):
pass
LDAP_ENABLE
=
CONF
.
getint
(
'ldap'
,
'ldap_enable'
)
class
LDAPMgmt
():
...
...
@@ -111,8 +86,54 @@ class LDAPMgmt():
return
plain_text
.
rstrip
(
'
\0
'
)
if
LDAP_ENABLE
:
LDAP_HOST_URL
=
CONF
.
get
(
'ldap'
,
'host_url'
)
LDAP_BASE_DN
=
CONF
.
get
(
'ldap'
,
'base_dn'
)
LDAP_ROOT_DN
=
CONF
.
get
(
'ldap'
,
'root_dn'
)
LDAP_ROOT_PW
=
CONF
.
get
(
'ldap'
,
'root_pw'
)
ldap_conn
=
LDAPMgmt
(
LDAP_HOST_URL
,
LDAP_BASE_DN
,
LDAP_ROOT_DN
,
LDAP_ROOT_PW
)
else
:
ldap_conn
=
None
def
md5_crypt
(
string
):
return
hashlib
.
new
(
"md5"
,
string
)
.
hexdigest
()
def
get_session_user_dept
(
request
):
user_id
=
request
.
session
.
get
(
'user_id'
,
''
)
user
=
User
.
objects
.
filter
(
id
=
user_id
)
if
user
:
user
=
user
[
0
]
dept
=
user
.
dept
return
user
,
dept
class
PyCrypt
(
object
):
"""This class used to encrypt and decrypt password."""
def
__init__
(
self
,
key
):
self
.
key
=
key
self
.
mode
=
AES
.
MODE_CBC
def
encrypt
(
self
,
text
):
cryptor
=
AES
.
new
(
self
.
key
,
self
.
mode
,
b
'0000000000000000'
)
length
=
16
try
:
count
=
len
(
text
)
except
TypeError
:
raise
ServerError
(
'Encrypt password error, TYpe error.'
)
add
=
(
length
-
(
count
%
length
))
text
+=
(
'
\0
'
*
add
)
ciphertext
=
cryptor
.
encrypt
(
text
)
return
b2a_hex
(
ciphertext
)
CRYPTOR
=
PyCrypt
(
KEY
)
class
ServerError
(
Exception
):
pass
def
require_login
(
func
):
...
...
jumpserver/views.py
View file @
a2ede31a
#coding: utf-8
#
coding: utf-8
import
hashlib
from
ConfigParser
import
ConfigParser
...
...
@@ -17,27 +17,7 @@ from django.template import RequestContext
from
juser.models
import
User
,
UserGroup
from
jlog.models
import
Log
from
jasset.models
import
Asset
,
BisGroup
,
IDC
from
jumpserver.api
import
require_admin
,
require_super_user
,
require_login
,
CRYPTOR
,
LDAPMgmt
BASE_DIR
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
)))
CONF
=
ConfigParser
()
CONF
.
read
(
os
.
path
.
join
(
BASE_DIR
,
'jumpserver.conf'
))
LDAP_ENABLE
=
CONF
.
getint
(
'ldap'
,
'ldap_enable'
)
if
LDAP_ENABLE
:
LDAP_HOST_URL
=
CONF
.
get
(
'ldap'
,
'host_url'
)
LDAP_BASE_DN
=
CONF
.
get
(
'ldap'
,
'base_dn'
)
LDAP_ROOT_DN
=
CONF
.
get
(
'ldap'
,
'root_dn'
)
LDAP_ROOT_PW
=
CONF
.
get
(
'ldap'
,
'root_pw'
)
ldap_conn
=
LDAPMgmt
(
LDAP_HOST_URL
,
LDAP_BASE_DN
,
LDAP_ROOT_DN
,
LDAP_ROOT_PW
)
else
:
ldap_conn
=
None
def
md5_crypt
(
string
):
return
hashlib
.
new
(
"md5"
,
string
)
.
hexdigest
()
from
jumpserver.api
import
*
def
getDaysByNum
(
num
):
...
...
juser/urls.py
View file @
a2ede31a
...
...
@@ -7,14 +7,14 @@ urlpatterns = patterns('juser.views',
# url(r'^$', 'jumpserver.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
(
r'^dept_list/$'
,
'dept_list'
),
(
r'^dept_list/$'
,
view_splitter
,
{
'su'
:
dept_list
,
'adm'
:
dept_list_adm
}
),
(
r'^dept_add/$'
,
'dept_add'
),
(
r'^dept_del/$'
,
'dept_del'
),
(
r'^dept_detail/$'
,
'dept_detail'
),
(
r'^dept_del_ajax/$'
,
'dept_del_ajax'
),
(
r'^dept_edit/$'
,
'dept_edit'
),
(
r'^group_add/$'
,
'group_add'
),
(
r'^group_list/$'
,
view_splitter
,
{
'su'
:
group_list
_su
,
'adm'
:
group_list_adm
}),
(
r'^group_list/$'
,
view_splitter
,
{
'su'
:
group_list
,
'adm'
:
group_list_adm
}),
(
r'^group_detail/$'
,
'group_detail'
),
(
r'^group_del/$'
,
'group_del'
),
(
r'^group_del_ajax/$'
,
'group_del_ajax'
),
...
...
juser/views.py
View file @
a2ede31a
...
...
@@ -21,8 +21,7 @@ from juser.models import UserGroup, User, DEPT
from
connect
import
BASE_DIR
from
connect
import
CONF
from
jumpserver.views
import
md5_crypt
,
LDAPMgmt
,
LDAP_ENABLE
,
ldap_conn
,
page_list_return
,
pages
from
jumpserver.api
import
user_perm_group_api
,
require_login
,
require_super_user
,
\
require_admin
,
is_group_admin
,
is_super_user
,
CRYPTOR
from
jumpserver.api
import
*
if
LDAP_ENABLE
:
LDAP_HOST_URL
=
CONF
.
get
(
'ldap'
,
'host_url'
)
...
...
@@ -31,7 +30,7 @@ if LDAP_ENABLE:
LDAP_ROOT_PW
=
CONF
.
get
(
'ldap'
,
'root_pw'
)
def
gen_rand_wd
(
num
):
def
gen_rand_
p
wd
(
num
):
"""生成随机密码"""
seed
=
"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
salt_list
=
[]
...
...
@@ -236,6 +235,17 @@ def dept_list(request):
return
render_to_response
(
'juser/dept_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
@require_admin
def
dept_list_adm
(
request
):
header_title
,
path1
,
path2
=
'查看部门'
,
'用户管理'
,
'查看部门'
user
,
dept
=
get_session_user_dept
(
request
)
contact_list
=
[
dept
]
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
return
render_to_response
(
'juser/dept_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
@require_super_user
def
dept_detail
(
request
):
dept_id
=
request
.
GET
.
get
(
'id'
,
None
)
...
...
@@ -363,14 +373,21 @@ def group_add(request):
@require_super_user
def
group_list
_su
(
request
):
def
group_list
(
request
):
header_title
,
path1
,
path2
=
'查看小组'
,
'用户管理'
,
'查看小组'
keyword
=
request
.
GET
.
get
(
'search'
,
''
)
if
keyword
:
contact_list
=
UserGroup
.
objects
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
else
:
did
=
request
.
GET
.
get
(
'did'
,
''
)
contact_list
=
UserGroup
.
objects
.
all
()
.
order_by
(
'name'
)
if
did
:
dept
=
DEPT
.
objects
.
filter
(
id
=
did
)
if
dept
:
dept
=
dept
[
0
]
contact_list
=
dept
.
usergroup_set
.
all
()
if
keyword
:
contact_list
=
contact_list
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
return
render_to_response
(
'juser/group_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
@@ -379,11 +396,12 @@ def group_list_su(request):
def
group_list_adm
(
request
):
header_title
,
path1
,
path2
=
'查看部门小组'
,
'用户管理'
,
'查看小组'
keyword
=
request
.
GET
.
get
(
'search'
,
''
)
user_id
=
request
.
session
.
get
(
'user_id'
)
did
=
request
.
GET
.
get
(
'did'
,
''
)
user
,
dept
=
get_session_user_dept
(
request
)
contact_list
=
dept
.
usergroup_set
.
all
()
.
order_by
(
'name'
)
if
keyword
:
contact_list
=
UserGroup
.
objects
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
else
:
contact_list
=
UserGroup
.
objects
.
all
()
.
order_by
(
'name'
)
contact_list
=
contact_list
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
return
render_to_response
(
'juser/group_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
@@ -445,13 +463,28 @@ def group_edit(request):
else
:
group_id
=
request
.
POST
.
get
(
'group_id'
,
''
)
group_name
=
request
.
POST
.
get
(
'group_name'
,
''
)
dept_id
=
request
.
POST
.
get
(
'dept_id'
,
''
)
comment
=
request
.
POST
.
get
(
'comment'
,
''
)
users_selected
=
request
.
POST
.
getlist
(
'users_selected'
)
users
=
[]
try
:
if
''
in
[
group_id
,
group_name
]:
raise
AddError
(
'组名不能为空'
)
UserGroup
.
objects
.
filter
(
id
=
group_id
)
.
update
(
name
=
group_name
,
comment
=
comment
)
dept
=
DEPT
.
objects
.
filter
(
id
=
dept_id
)
if
dept
:
dept
=
dept
[
0
]
else
:
raise
AddError
(
'部门不存在'
)
for
user_id
in
users_selected
:
users
.
extend
(
User
.
objects
.
filter
(
id
=
user_id
))
user_group
=
UserGroup
.
objects
.
filter
(
id
=
group_id
)
if
user_group
:
user_group
.
update
(
name
=
group_name
,
comment
=
comment
,
dept
=
dept
)
user_group
=
user_group
[
0
]
user_group
.
user_set
.
clear
()
user_group
.
user_set
=
users
except
AddError
,
e
:
error
=
e
...
...
templates/jperm/dept_perm_list.html
View file @
a2ede31a
...
...
@@ -58,11 +58,11 @@
{% for dept in contacts.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ dept.name }}
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_user_num }}
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/user_list/?did={{ dept.id }}"
>
{{ dept.id | dept_user_num }}
</a>
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_asset_num }}
</td>
<td
class=
"text-center"
>
{{ dept.comment }}
</td>
<td
class=
"text-center"
>
<a
title=
"[ {{ dept.name }} ] 成员信息"
href=
"../dept_detail/?id={{ dept.id }}"
class=
"iframe btn btn-xs btn-primary"
>
主机
</a>
{#
<a
title=
"[ {{ dept.name }} ] 成员信息"
href=
"../dept_detail/?id={{ dept.id }}"
class=
"iframe btn btn-xs btn-primary"
>
主机
</a>
#}
<a
href=
"../dept_perm_edit/?id={{ dept.id }}"
class=
"btn btn-xs btn-danger"
>
授权编辑
</a>
</td>
</tr>
...
...
templates/jperm/perm_list.html
View file @
a2ede31a
...
...
@@ -60,7 +60,7 @@
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ group.name }}
</td>
<td
class=
"text-center"
>
{{ group.dept.name }}
</td>
<td
class=
"text-center"
>
{{ group.id | member_count }}
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/user_list/?did={{ group.id }}"
>
{{ group.id | member_count }}
</a>
</td>
<td
class=
"text-center"
>
{{ group.id | ugrp_perm_agrp_count }}
</td>
<td
class=
"text-center"
>
{{ group.id | ugrp_perm_asset_count }}
</td>
<td
class=
"text-center"
>
{{ group.comment }}
</td>
...
...
templates/jperm/sudo_cmd_list.html
View file @
a2ede31a
...
...
@@ -58,10 +58,10 @@
{% for group in contacts.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ group.name }}
</td>
<td
class=
"text-center"
>
{{ group.cmd | string_length:50 }}
</td>
<td
class=
"text-center"
title=
"{{ group.cmd }}"
>
{{ group.cmd | string_length:50 }}
</td>
<td
class=
"text-center"
>
{{ group.comment }}
</td>
<td
class=
"text-center"
>
<a
href=
"../cmd_detail/?id={{ group.id }}"
class=
"btn btn-xs btn-info"
>
详情
</a>
{#
<a
href=
"../cmd_detail/?id={{ group.id }}"
class=
"btn btn-xs btn-info"
>
详情
</a>
#}
<a
href=
"../cmd_edit/?id={{ group.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"../cmd_del/?id={{ group.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</td>
...
...
templates/juser/dept_detail.html
View file @
a2ede31a
{% extends 'base.html' %}
{% load mytags %}
<html>
<head>
{% include 'link_css.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<style
type=
"text/css"
>
body
{
background
:
#FFFFFF
;
}
</style>
</head>
<body>
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"contact-box"
>
<h2
class=
"text-center"
><b>
{{ dept.name }}
</b>
部门成员
</h2>
<div
class=
"col-lg-10"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
查看部门
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
>
未启用 1
</a>
</li>
<li><a
href=
"#"
>
未启用 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/juser/dept_add/"
class=
"btn btn-sm btn-primary "
>
添加部门
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger"
>
删除所选
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"search"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
Search
</button>
</div>
</div>
</form>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
>
用户名
</th>
<th
class=
"text-center"
>
姓名
</th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"select_all"
onclick=
"selectAll()"
name=
"select_all"
>
</th>
<th
class=
"text-center"
>
部门名称
</th>
<th
class=
"text-center"
>
小组数目
</th>
<th
class=
"text-center"
>
成员数目
</th>
<th
class=
"text-center"
>
主机数目
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</thead>
<tbody>
{% for
user in users
%}
{% for
dept in contacts.object_list
%}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ user.username }}
</td>
<td
class=
"text-center"
>
{{ user.name }}
</td>
<td
class=
"text-center"
>
{{ user.id|get_role }}
</td>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"selected"
value=
"{{ dept.id }}"
>
</td>
<td
class=
"text-center"
>
{{ dept.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/group_list/?did={{ dept.id }}"
>
{{ dept.id | dept_group_num }}
</a>
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/user_list/?did={{ dept.id }}"
>
{{ dept.id | dept_user_num}}
</a>
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_asset_num}}
</td>
<td
class=
"text-center"
>
{{ dept.comment }}
</td>
<td
class=
"text-center"
>
<a
href=
"../dept_detail/?id={{ dept.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"../dept_edit/?id={{ dept.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"../dept_del/?id={{ dept.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</td>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
</body>
</html>
\ No newline at end of file
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
".iframe"
).
colorbox
({
iframe
:
true
,
width
:
"70%"
,
height
:
"70%"
});
var
check_array
=
[]
$
(
'#del_btn'
).
click
(
function
(){
if
(
confirm
(
"确定删除"
))
{
$
(
".gradeX input:checked"
).
each
(
function
()
{
check_array
.
push
(
$
(
this
).
attr
(
"value"
))
})
$
(
".gradeX input:checked"
).
closest
(
"tr"
).
remove
()
$
.
post
(
"/juser/dept_del_ajax/"
,
{
dept_ids
:
check_array
.
join
(
","
)},
function
(
data
){
alert
(
data
)
}
)
}
})
});
</script>
{% endblock %}
\ No newline at end of file
templates/juser/dept_list.html
View file @
a2ede31a
...
...
@@ -65,13 +65,19 @@
<input
type=
"checkbox"
name=
"selected"
value=
"{{ dept.id }}"
>
</td>
<td
class=
"text-center"
>
{{ dept.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/
"
>
{{ dept.id | dept_group_num
}}
</a>
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_user_num}}
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/
group_list/?did={{ dept.id }}"
>
{{ dept.id | dept_group_num
}}
</a>
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/user_list/?did={{ dept.id }}"
>
{{ dept.id | dept_user_num}}
</a>
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_asset_num}}
</td>
<td
class=
"text-center"
>
{{ dept.comment }}
</td>
<td
class=
"text-center"
>
{#
<a
href=
"../dept_detail/?id={{ dept.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
#}
{% ifequal session_role_id 2 %}
<a
href=
"../dept_edit/?id={{ dept.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"../dept_del/?id={{ dept.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
{% else %}
<a
href=
"../dept_edit/?id={{ dept.id }}"
class=
"btn btn-xs btn-info disabled"
>
编辑
</a>
<a
href=
"../dept_del/?id={{ dept.id }}"
class=
"btn btn-xs btn-danger disabled"
>
删除
</a>
{% endifequal %}
</td>
</tr>
{% endfor %}
...
...
templates/juser/group_list.html
View file @
a2ede31a
...
...
@@ -65,10 +65,9 @@
</td>
<td
class=
"text-center"
>
{{ group.name }}
</td>
<td
class=
"text-center"
>
{{ group.dept.name }}
</td>
<td
class=
"text-center"
>
{{ group.id | member_count }}
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/user_list/?gid={{ group.id }}"
>
{{ group.id | member_count }}
</a>
</td>
<td
class=
"text-center"
>
{{ group.comment }}
</td>
<td
class=
"text-center"
>
<a
href=
"../user_list/group/?gid={{ group.id }}"
class=
"btn btn-xs btn-primary"
>
成员
</a>
<a
href=
"../group_edit/?id={{ group.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"../group_del/?id={{ group.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</td>
...
...
templates/nav.html
View file @
a2ede31a
...
...
@@ -15,9 +15,9 @@
<li
id=
"juser"
>
<a
href=
"#"
><i
class=
"fa fa-rebel"
></i>
<span
class=
"nav-label"
>
用户管理
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<li
class=
"dept_list"
><a
href=
"/juser/dept_list/"
>
查看部门
</a></li>
<li
class=
"dept_list
dept_edit
"
><a
href=
"/juser/dept_list/"
>
查看部门
</a></li>
<li
class=
"dept_add"
><a
href=
"/juser/dept_add/"
>
添加部门
</a></li>
<li
class=
"group_list"
><a
href=
"/juser/group_list/"
>
查看小组
</a></li>
<li
class=
"group_list
group_edit
"
><a
href=
"/juser/group_list/"
>
查看小组
</a></li>
<li
class=
"group_add"
><a
href=
"/juser/group_add/"
>
添加小组
</a></li>
<li
class=
"user_list user_edit"
><a
href=
"/juser/user_list/"
>
查看用户
<span
class=
"label {% ifequal user_active_num user_total_num %}label-primary {% else %}label-warning {% endifequal %}pull-right"
>
{{ user_active_num }}/{{ user_total_num }}
</span></a></li>
<li
class=
"user_add"
><a
href=
"/juser/user_add/"
>
添加用户
</a></li>
...
...
@@ -37,15 +37,15 @@
<li
id=
"jperm"
>
<a
href=
"#"
><i
class=
"fa fa-edit"
></i>
<span
class=
"nav-label"
>
授权管理
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<li
id=
"dept_perm_lis
t"
>
<li
class=
"dept_perm_list dept_perm_edi
t"
>
<a
href=
"/jperm/dept_perm_list/"
>
部门授权
</a>
</li>
<li
id=
"perm_lis
t"
>
<li
class=
"perm_list perm_edi
t"
>
<a
href=
"/jperm/perm_list/"
>
小组授权
</a>
</li>
<li
id=
"sudo_add
"
>
<li
class=
"sudo_list sudo_edit sudo_add cmd_list cmd_edit
"
>
<a
href=
"/jperm/sudo_list/"
>
Sudo授权
</a>
</li>
</ul>
...
...
@@ -90,10 +90,11 @@
<li
id=
"juser"
>
<a
href=
"#"
><i
class=
"fa fa-rebel"
></i>
<span
class=
"nav-label"
>
用户管理
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<li
id=
"group_list"
><a
href=
"/juser/group_list/"
>
查看小组
</a></li>
<li
id=
"group_add"
><a
href=
"/juser/group_add/"
>
添加小组
</a></li>
<li
id=
"user_list"
><a
href=
"/juser/user_list/"
>
查看用户
<span
class=
"label {% ifequal user_active_num user_total_num %}label-primary {% else %}label-warning {% endifequal %}pull-right"
>
{{ user_active_num }}/{{ user_total_num }}
</span></a></li>
<li
id=
"user_add"
><a
href=
"/juser/user_add/"
>
添加用户
</a></li>
<li
class=
"dept_list dept_edit"
><a
href=
"/juser/dept_list/"
>
查看部门
</a></li>
<li
class=
"group_list"
><a
href=
"/juser/group_list/"
>
查看小组
</a></li>
<li
class=
"group_add"
><a
href=
"/juser/group_add/"
>
添加小组
</a></li>
<li
class=
"user_list"
><a
href=
"/juser/user_list/"
>
查看用户
<span
class=
"label {% ifequal user_active_num user_total_num %}label-primary {% else %}label-warning {% endifequal %}pull-right"
>
{{ user_active_num }}/{{ user_total_num }}
</span></a></li>
<li
class=
"user_add"
><a
href=
"/juser/user_add/"
>
添加用户
</a></li>
</ul>
</li>
<li
id=
"jasset"
>
...
...
templates/paginator_new..html
View file @
a2ede31a
...
...
@@ -49,7 +49,7 @@
{% else %}
{% if contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"?page={{ contacts.previous_page_number }}{{ href }}"
>
Previous
</a>
<a
class=
"test"
href=
"?page={{ contacts.previous_page_number }}{{ href }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
>
...
...
@@ -57,25 +57,25 @@
</li>
{% endif %}
{% ifequal show_first 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page=1{{ href }}"
title=
"第1页"
>
1...
</a></li>
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
class=
"test"
href=
"?page=1{{ href }}"
title=
"第1页"
>
1...
</a></li>
{% endifequal %}
{% for page in page_range %}
{% ifequal current_page page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
class=
"test"
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
class=
"test"
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% ifequal show_end 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ p.num_pages }}"
title=
"第{{ page }}页"
>
...{{ p.num_pages }}
</a></li>
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
class=
"test"
href=
"?page={{ p.num_pages }}"
title=
"第{{ page }}页"
>
...{{ p.num_pages }}
</a></li>
{% endifequal %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"?page={{ contacts.next_page_number }}"
>
Next
</a>
<a
class=
"test"
href=
"?page={{ contacts.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"#"
>
Next
</a>
<a
class=
"test"
href=
"#"
>
Next
</a>
</li>
{% endif %}
{% endif %}
...
...
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