Пример #1
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.html', **ps)
Пример #2
0
 def get(self):
     ps = self.get_page_config(title = '用户应用权限信息')
     ps['userID'] = int(self.get_arg('userID', '0'))
     if 0 == ps['userID']:
         ps['msg'] = state.ResultInfo.get(103007, '')
         ps['gotoUrl'] = ps['siteDomain'] +'Admin/User/List'
         self.render('admin/user/right.html', **ps)
         return
     
     ps['appCode'] = self.get_arg('appCode', '')
     ps['apps'] = application_logic.query_all_by_active()
     if None == ps['apps'] or len(ps['apps']) <= 0:
         ps['msg'] = state.ResultInfo.get(101004, '')
         ps['gotoUrl'] = ps['siteDomain'] +'Admin/Application/Add'
         self.render('admin/user/right_detail.html', **ps)
         return
     else:
         if '' == ps['appCode']:
             ps['appCode'] = ps['apps'][0]['code']
     
     ps['roles'] = user_logic.query_all_user_roles(
             userID = ps['userID'])
     user = user_logic.query_one(id = ps['userID'])
     ps['userName'] = user['name']
     ps['userRealName'] = user['realName']
     ps['userGroups'] = usergroup_logic.query_all_user_groups(
             userID = ps['userID'])
     
     ps = self.format_none_to_empty(ps)
     funcs = user_logic.query_user_app_right(userID = ps['userID'], appCode = ps['appCode'])
     ps['funcs'] = funcs
     
     self.render('admin/user/right_detail.html', **ps)
Пример #3
0
    def get(self):
        ps = self.get_page_config(title='用户应用权限信息')
        ps['userID'] = int(self.get_arg('userID', '0'))
        if 0 == ps['userID']:
            ps['msg'] = state.ResultInfo.get(103007, '')
            ps['gotoUrl'] = ps['siteDomain'] + 'Admin/User/List'
            self.render('admin/user/right_detail_bs.html', **ps)
            return

        ps['appCode'] = self.get_arg('appCode', '')
        ps['apps'] = application_logic.query_all_by_active()
        if None == ps['apps'] or len(ps['apps']) <= 0:
            ps['msg'] = state.ResultInfo.get(101004, '')
            ps['gotoUrl'] = ps['siteDomain'] + 'Admin/Application/Add'
            self.render('admin/user/right_detail_bs.html', **ps)
            return
        else:
            if '' == ps['appCode']:
                ps['appCode'] = ps['apps'][0]['code']

        ps['roles'] = user_logic.query_all_user_roles(userID=ps['userID'])
        user = user_logic.query_one(id=ps['userID'])
        ps['userName'] = user['name']
        ps['userRealName'] = user['realName']
        ps['userGroups'] = usergroup_logic.query_all_user_groups(
            userID=ps['userID'])

        ps = self.format_none_to_empty(ps)
        funcs = user_logic.query_user_app_right(userID=ps['userID'],
                                                appCode=ps['appCode'])
        ps['funcs'] = funcs

        self.render('admin/user/right_detail_bs.html', **ps)
Пример #4
0
 def get(self):
     ps = self.get_page_config(title='用户详情')
     id = int(self.get_arg('id', '0'))
     user = user_logic.query_one(id)
     if None == user:
         ps['msg'] = state.ResultInfo.get(103002, '')
         ps['gotoUrl'] = ps['siteDomain'] + 'Admin/User/List'
         user = {
             'id': '',
             'name': '',
             'passWord': '',
             'statusname': '',
             'mobile': '',
             'tel': '',
             'email': '',
             'status': 1,
             'lastLoginTime': '',
             'lastLoginApp': '',
             'lastLoginIp': '',
             'remark': '',
             'creater': '',
             'createTime': '',
             'lastUpdater': '',
             'lastUpdateTime': ''
         }
     ps['user'] = user
     ps = self.format_none_to_empty(ps)
     self.render('admin/user/detail_bs.html', **ps)
Пример #5
0
    def get(self):
        ps = self.get_page_config(title = '新增角色绑定用户')
        ps['userID'] = int(self.get_arg('userID', '0'))
        if 0 == ps['userID']:
            ps['msg'] = state.ResultInfo.get(103003, '')
            ps['gotoUrl'] = ps['siteDomain'] +'Admin/User/Add'
            self.render('admin/user/role_list.html', **ps)
            return

        ps['page'] = int(self.get_arg('page', '1'))        
        ps['roleName'] = self.get_arg('roleName', '')
        ps['roleID'] = int(self.get_arg('roleID', '0'))
        ps['roleInfo'] = ''
        if ps['roleID'] > 0:
            roleInfo = role_logic.query_one(id = ps['roleID'])
            ps['roleInfo'] = roleInfo['name']        

        ps['pagedata'] = role_logic.query_page(name = ps['roleName'], 
            status = state.statusActive, page = ps['page'], size = ps['size'])
        
        user = user_logic.query_one(id = ps['userID'])
        ps['userInfo'] = user['name']
        ps['userRealName'] = user['realName']

        ps = self.format_none_to_empty(ps)
        ps['pager'] = self.build_page_html(page = ps['page'], size = ps['size'], total = ps['pagedata']['total'], pageTotal = ps['pagedata']['pagetotal'])        
        self.render('admin/user/role_bind.html', **ps)
Пример #6
0
    def get(self):
        ps = self.get_page_config(title = '新增用户绑定用户组')
        ps['userGroupID'] = int(self.get_arg('userGroupID', '0'))
        userGroups = usergroup_logic.query_all_by_active()
        if None == userGroups or len(userGroups) == 0:
            ps['msg'] = state.ResultInfo.get(105003, '')
            ps['gotoUrl'] = ps['siteDomain'] +'Admin/UserGroup/Add'
            self.render('admin/usergroup/user_bind.html', **ps)
            return
        else:
            if 0 == ps['userGroupID']:
                ps['userGroupID'] = userGroups[0]['id']

        ps['userGroups'] = userGroups
        ps['page'] = int(self.get_arg('page', '1'))        
        ps['userName'] = self.get_arg('userName', '')
        ps['userID'] = int(self.get_arg('userID', '0'))
        ps['userInfo'] = ''
        if ps['userID'] > 0:
            userInfo = user_logic.query_one(id = ps['userID'])
            ps['userInfo'] = userInfo['name']        

        ps['pagedata'] = user_logic.query_page(name = ps['userName'], 
            status = state.statusActive, page = ps['page'], size = ps['size'])
        ps = self.format_none_to_empty(ps)
        ps['pager'] = self.build_page_html(page = ps['page'], size = ps['size'], total = ps['pagedata']['total'], pageTotal = ps['pagedata']['pagetotal'])        
        self.render('admin/usergroup/user_bind.html', **ps)
Пример #7
0
 def get(self):
     ps = self.get_page_config(title = '用户详情')
     id = int(self.get_arg('id', '0'))
     user = user_logic.query_one(id)
     if None == user:
         ps['msg'] = state.ResultInfo.get(103002, '')
         ps['gotoUrl'] = ps['siteDomain'] + 'Admin/User/List'
         user = {'id':'','name':'', 'passWord':'', 'statusname':'','mobile':'','tel':'','email':'','status':1,'lastLoginTime':'','lastLoginApp':'','lastLoginIp':'','remark':'','creater':'','createTime':'','lastUpdater':'','lastUpdateTime':''}        
     ps['user'] = user
     ps = self.format_none_to_empty(ps)
     self.render('admin/user/detail.html', **ps)
Пример #8
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)
Пример #9
0
 def post(self):
     id = int(self.get_arg('id', '0'))
     user = self.get_oper_user()
     ou = user_logic.query_one(id = id)
     type = user_logic.delete(id = id, user = user)
     if type:
         try:
             self.write_oper_log(action = 'userDelete', targetType = 1, targetID = str(id), targetName = ou['name'], startStatus = str_helper.json_encode(ou), endStatus= '')
         except e:
             print e
         self.out_ok()
     else:
         self.out_fail(code = 101)
Пример #10
0
    def post(self):
        ps = self.get_page_config(title = '用户绑定用户组列表')
        ps['userID'] = int(self.get_arg('userID', '0'))
        if 0 == ps['userID']:            
            self.out_fail(code = 103007)
            return
        
        user = user_logic.query_one(id = ps['userID'])
        ps['page'] = int(self.get_arg('page', '1'))

        ps['pagedata'] = usergroup_logic.query_page_user_groups(
                userID = ps['userID'], page = ps['page'], size = ps['size'])
        
        self.out_ok(data = ps['pagedata'])
Пример #11
0
    def post(self):
        ps = self.get_page_config(title='用户绑定用户组列表')
        ps['userID'] = int(self.get_arg('userID', '0'))
        if 0 == ps['userID']:
            self.out_fail(code=103007)
            return

        user = user_logic.query_one(id=ps['userID'])
        ps['page'] = int(self.get_arg('page', '1'))

        ps['pagedata'] = usergroup_logic.query_page_user_groups(
            userID=ps['userID'], page=ps['page'], size=ps['size'])

        self.out_ok(data=ps['pagedata'])
Пример #12
0
    def get(self):
        ps = self.get_page_config(title='用户绑定角色列表')
        ps['userID'] = int(self.get_arg('userID', '0'))
        if 0 == ps['userID']:
            ps['msg'] = state.ResultInfo.get(105003, '')
            ps['gotoUrl'] = ps['siteDomain'] + 'Admin/User/Add'
            self.render('admin/user/role_list.html', **ps)
            return

        user = user_logic.query_one(id=ps['userID'])
        ps['userName'] = user['name']
        ps['userRealName'] = user['realName']
        ps = self.format_none_to_empty(ps)
        self.render('admin/user/role_list_bs.html', **ps)
Пример #13
0
 def get(self):
     ps = self.get_page_config(title = '用户绑定角色列表')
     ps['userID'] = int(self.get_arg('userID', '0'))
     if 0 == ps['userID']:
         ps['msg'] = state.ResultInfo.get(105003, '')
         ps['gotoUrl'] = ps['siteDomain'] +'Admin/User/Add'
         self.render('admin/user/role_list.html', **ps)
         return
     
     user = user_logic.query_one(id = ps['userID'])
     ps['userName'] = user['name']
     ps['userRealName'] = user['realName']
     ps = self.format_none_to_empty(ps)
     self.render('admin/user/role_list_bs.html', **ps)
Пример #14
0
 def post(self):
     type = self.check_oper_right_custom_right(self._rightKey, self._lockUserKey)
     if type == False:
         self.out_fail(code = 1004)
         return
     id = int(self.get_arg('id', '0'))
     user = self.get_oper_user()
     ou = user_logic.query_one(id = id)
     type = user_logic.update_status(id = id, status = 3, user = user)
     if type:
         try:
             self.write_oper_log(action = 'userLock', targetType = 1, targetID = str(id), targetName = ou['name'], startStatus = str_helper.json_encode(ou), endStatus= '')
         except e:
             print e
         self.out_ok()
     else:
         self.out_fail(code = 101)
Пример #15
0
 def post(self):
     id = int(self.get_arg('id', '0'))
     user = self.get_oper_user()
     ou = user_logic.query_one(id=id)
     type = user_logic.delete(id=id, user=user)
     if type:
         try:
             self.write_oper_log(action='userDelete',
                                 targetType=1,
                                 targetID=str(id),
                                 targetName=ou['name'],
                                 startStatus=str_helper.json_encode(ou),
                                 endStatus='')
         except e:
             print e
         self.out_ok()
     else:
         self.out_fail(code=101)
Пример #16
0
    def get(self):
        ps = self.get_page_config(title = '用户绑定用户组列表')
        ps['userID'] = int(self.get_arg('userID', '0'))
        if 0 == ps['userID']:
            ps['msg'] = state.ResultInfo.get(103007, '')
            ps['gotoUrl'] = ps['siteDomain'] +'Admin/User/List'
            self.render('admin/user/right.html', **ps)
            return
        
        user = user_logic.query_one(id = ps['userID'])
        ps['userName'] = user['name']
        ps['userRealName'] = user['realName']

        ps['page'] = int(self.get_arg('page', '1'))
        ps['pagedata'] = usergroup_logic.query_page_user_groups(
                userID = ps['userID'], page = ps['page'], size = ps['size'])        
        ps = self.format_none_to_empty(ps)
        ps['pager'] = self.build_page_html(page = ps['page'], size = ps['size'], total = ps['pagedata']['total'], pageTotal = ps['pagedata']['pagetotal'])
        self.render('admin/user/group_list.html', **ps)
Пример #17
0
 def post(self):
     type = self.check_oper_right_custom_right(self._rightKey,
                                               self._lockUserKey)
     if type == False:
         self.out_fail(code=1004)
         return
     id = int(self.get_arg('id', '0'))
     user = self.get_oper_user()
     ou = user_logic.query_one(id=id)
     type = user_logic.update_status(id=id, status=3, user=user)
     if type:
         try:
             self.write_oper_log(action='userLock',
                                 targetType=1,
                                 targetID=str(id),
                                 targetName=ou['name'],
                                 startStatus=str_helper.json_encode(ou),
                                 endStatus='')
         except e:
             print e
         self.out_ok()
     else:
         self.out_fail(code=101)