#-*- encoding: utf-8 -*-
import tornado.web
import tornado.escape
import copy
from datetime import datetime, timedelta
import config
import admin_base_handler
from common import redis_cache, state, error
from helper import str_helper, http_helper
from logic import user_logic, role_logic, application_logic, usergroup_logic, department_logic, oper_log_logic
class UserListHandler(admin_base_handler.AdminRightBaseHandler):
_rightKey = config.SOCRightConfig['appCode'] + '.UserManager'
_right = state.operView
def get(self):
ps = self.get_page_config(title = '用户列表')
ps['ExportType'] = self.check_oper_right_custom_right(self._rightKey, self._exportUserKey)
ps['LockType'] = self.check_oper_right_custom_right(self._rightKey, self._lockUserKey)
user = self.get_args(['id', 'realName', 'name', 'tel', 'mobile', 'email', 'createTimeBegin', 'createTimeEnd', 'lastUpdateTimeBegin', 'lastUpdateTimeEnd'], '')
user['status'] = int(self.get_arg('status', '0'))
user['departmentID'] = int(self.get_arg('departmentID', '0'))
ps['deps'] = department_logic.query_all_by_active()
ps['page'] = int(self.get_arg('page', '1'))
ps['userStatus'] = state.UserStatus
ps['pagedata'] = user_logic.query_page(id = user['id'],
name = user['name'], realName = user['realName'], departmentID = user['departmentID'],
tel = user['tel'], mobile = user['mobile'], email = user['email'],
status = user['status'], createTimeBegin = user['createTimeBegin'], createTimeEnd = user['createTimeEnd'], lastUpdateTimeBegin = user['lastUpdateTimeBegin'], lastUpdateTimeEnd = user['lastUpdateTimeEnd'], page = ps['page'], size = ps['size'])
ps['user'] = user
ps = self.format_none_to_empty(ps)
ps['pager'] = self.build_page_html_bs(page = ps['page'], size = ps['size'], total = ps['pagedata']['total'], pageTotal = ps['pagedata']['pagetotal'])
self.render('admin/user/list_bs.html', **ps)
class UserAddOrEditHandler(admin_base_handler.AdminRightBaseHandler):
_rightKey = config.SOCRightConfig['appCode'] + '.UserManager'
_right = 0
def get(self):
ps = self.get_page_config(title = '创建用户', refUrl = config.SOCRightConfig['siteDomain'] + 'Admin/User/List')
ps['ResetPasswordType'] = self.check_oper_right_custom_right(self._rightKey, self._resetPwKey)
if ps['isedit']:
self.check_oper_right(right = state.operEdit)
ps['title'] = self.get_page_title('编辑用户')
id = int(self.get_arg('id', '0'))
user = user_logic.query_one(id)
if None == user:
ps['msg'] = state.ResultInfo.get(103002, '')
user = {'id':'', 'name':'', 'departmentID': '', 'realName':'','beginDate':'','endDate':'', 'passWord':'','mobile':'','tel':'','email':'','status':1,'lastLoginTime':'','lastLoginApp':'','lastLoginIp':'','remark':'','creater':'','createTime':'','lastUpdater':'','lastUpdateTime':''}
else:
self.check_oper_right(right = state.operAdd)
user = self.get_args(['id', 'name', 'realName', 'departmentID', 'passWord', 'mobile', 'tel', 'email', 'remark'], '')
user['beginDate'] = str_helper.get_now_datestr()
user['endDate'] = str_helper.get_add_datest(days = 365)
user['status'] = int(self.get_arg('status', '0'))
ps['user'] = user
ps['roleID'] = self.get_arg('roleID', '')
ps['userGroupID'] = self.get_arg('userGroupID', '')
ps['userStatus'] = state.UserStatus
ps['deps'] = department_logic.query_all_by_active()
ps = self.format_none_to_empty(ps)
self.render('admin/user/add_or_edit_bs.html', **ps)
def post(self):
ps = self.get_page_config(title = '创建用户')
ps['ResetPasswordType'] = self.check_oper_right_custom_right(self._rightKey, self._resetPwKey)
if ps['isedit']:
ps['title'] = self.get_page_title('编辑用户')
user = self.get_args(['id', 'passWord', 'name', 'realName', 'mobile', 'tel', 'email', 'remark', 'beginDate', 'endDate'], '')
user['status'] = int(self.get_arg('status', '0'))
user['departmentID'] = int(self.get_arg('departmentID', '0'))
user['parentID'] = int(self.get_arg('parentID', '0'))
ps['user'] = user
ps['userStatus'] = state.UserStatus
ps['roleID'] = self.get_arg('role', '')
ps['userGroupID'] = self.get_arg('userGroup', '')
ps['deps'] = department_logic.query_all_by_active()
msg = self.check_str_empty_input(user, ['name', 'realName', 'email', 'mobile', 'beginDate', 'endDate'])
if str_helper.is_null_or_empty(msg) == False:
ps['msg'] = msg
ps = self.format_none_to_empty(ps)
self.render('admin/user/add_or_edit_bs.html', **ps)
return
user['user'] = self.get_oper_user()
ps['user'] = copy.copy(user)
if ps['isedit']:
self.check_oper_right(right = state.operEdit)
try:
ou = user_logic.query_one_by_name(name = user['name'])
info = user_logic.update(id = user['id'], realName = user['realName'],
departmentID = user['departmentID'], parentID = user['parentID'], mobile = user['mobile'],
tel = user['tel'], email = user['email'], status = user['status'], beginDate = user['beginDate'],
endDate = user['endDate'], remark = user['remark'], user = user['user'])
if info:
nu = user_logic.query_one_by_name(name = user['name'])
self.bind_role(userID = nu['id'], roleID = ps['roleID'], user = user['user'])
self.bind_user_group(userID = nu['id'], userGroupID = ps['userGroupID'], user = user['user'])
self.write_oper_log(action = 'userEdit', targetType = 1, targetID = str(nu['id']), targetName = nu['name'], startStatus = str_helper.json_encode(ou), endStatus= str_helper.json_encode(nu))
ps = self.get_ok_and_back_params(ps = ps, refUrl = ps['refUrl'])
else:
ps['msg'] = state.ResultInfo.get(101, '')
except error.RightError as e:
ps['msg'] = e.msg
else:
self.check_oper_right(right = state.operEdit)
try:
info = user_logic.add(name = user['name'], passWord = user['passWord'],
realName = user['realName'], departmentID = user['departmentID'], mobile = user['mobile'],
tel = user['tel'], email = user['email'],beginDate = user['beginDate'],
endDate = user['endDate'], status = user['status'], remark = user['remark'],
parentID = user['parentID'], user = user['user'])
if info > 0:
nu = user_logic.query_one_by_name(name = user['name'])
self.bind_role(userID = nu['id'], roleID = ps['roleID'], user = user['user'])
self.bind_user_group(userID = nu['id'], userGroupID = ps['userGroupID'], user = user['user'])
self.write_oper_log(action = 'userCreate', targetType = 1, targetID = str(nu['id']), targetName = nu['name'], startStatus = '', endStatus= str_helper.json_encode(nu))
ps = self.get_ok_and_back_params(ps = ps, refUrl = ps['refUrl'])
else:
ps['msg'] = state.ResultInfo.get(101, '')
except error.RightError as e:
ps['msg'] = e.msg
ps = self.format_none_to_empty(ps)
self.render('admin/user/add_or_edit_bs.html', **ps)
de
没有合适的资源?快使用搜索试试~ 我知道了~
云海统一权限管理系统是基于python的tornado框架实现的一个统一权限管理系统。.zip
共258个文件
png:77个
css:57个
py:45个
需积分: 0 0 下载量 201 浏览量
2024-01-09
22:50:17
上传
评论
收藏 820KB ZIP 举报
温馨提示
Python使用技巧,实战应用开发小系统参考资料,源码参考。经测试可运行。 详细介绍了一些Python框架的各种功能和模块,以及如何使用Python进行GUI开发、网络编程和跨平台应用开发等。 适用于初学者和有经验的开发者,能够帮助你快速上手JPython并掌握其高级特性。
资源推荐
资源详情
资源评论
收起资源包目录
云海统一权限管理系统是基于python的tornado框架实现的一个统一权限管理系统。.zip (258个子文件)
nginx.conf 2KB
bootstrap.css 118KB
bootstrap.min.css 98KB
_all.css 21KB
_all.css 15KB
_all.css 15KB
bootstrap-theme.css 15KB
_all.css 13KB
bootstrap-theme.min.css 13KB
zTreeStyle.css 6KB
datepicker.css 4KB
datepicker.css 3KB
style.css 3KB
purple.css 2KB
yellow.css 2KB
orange.css 2KB
green.css 2KB
blue.css 2KB
pink.css 2KB
aero.css 2KB
grey.css 2KB
red.css 2KB
line.css 2KB
purple.css 2KB
orange.css 2KB
yellow.css 2KB
purple.css 2KB
orange.css 2KB
yellow.css 2KB
green.css 2KB
green.css 2KB
pink.css 2KB
blue.css 2KB
grey.css 2KB
aero.css 2KB
all.css 2KB
pink.css 2KB
blue.css 2KB
grey.css 2KB
aero.css 2KB
red.css 2KB
red.css 2KB
minimal.css 1KB
polaris.css 1KB
square.css 1KB
orange.css 1KB
purple.css 1KB
yellow.css 1KB
green.css 1KB
blue.css 1KB
aero.css 1KB
pink.css 1KB
grey.css 1KB
futurico.css 1KB
red.css 1KB
flat.css 1KB
bs_style.css 1KB
WdatePicker.css 186B
glyphicons-halflings-regular.eot 20KB
zTreeStandard.gif 5KB
img.gif 2KB
img.gif 2KB
datePicker.gif 1KB
loading.gif 381B
line_conn.gif 45B
.gitignore 38B
detail_bs.html 19KB
user_list_bs.html 14KB
group_list_bs.html 13KB
role_list_bs.html 12KB
role_list_bs.html 12KB
list_bs.html 12KB
right_edit_bs.html 10KB
add_or_edit_bs.html 9KB
right_detail_bs.html 7KB
list_bs.html 7KB
list_bs.html 7KB
right_detail_bs.html 7KB
right_detail_bs.html 6KB
user_list_bs.html 6KB
list_bs.html 6KB
main_bs.html 5KB
user_group_list_bs.html 5KB
list_bs.html 5KB
detail_bs.html 4KB
list_bs.html 4KB
add_or_edit_bs.html 4KB
detail_bs.html 3KB
list_bs.html 3KB
add_or_edit_bs.html 3KB
add_or_edit_bs.html 3KB
add_or_edit_bs.html 3KB
detail_bs.html 3KB
detail_bs.html 3KB
detail_bs.html 3KB
base_bs.html 2KB
base_a_bs.html 1KB
login_bs.html 1KB
password_edit_bs.html 1KB
base_s_bs.html 1KB
共 258 条
- 1
- 2
- 3
资源评论
白话Learning
- 粉丝: 3269
- 资源: 2464
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功