示例#1
0
def GetRoleScope(userInfo, permissionItemScopeCode):
    if userInfo.IsAdministrator or (not permissionItemScopeCode) or (
            not SystemInfo.EnableUserAuthorizationScope):
        returnValue = RoleService.GetDT(userInfo)
    else:
        returnValue = ScopPermission.GetRoleDTByPermissionScope(
            userInfo, permissionItemScopeCode)
    return returnValue
示例#2
0
    def GetUserPageDTByDepartment(self,
                                  userInfo,
                                  permissionScopeCode,
                                  searchValue,
                                  enabled,
                                  auditStates,
                                  roleIds,
                                  showRole,
                                  userAllInformation,
                                  pageIndex=0,
                                  pageSize=100,
                                  sort=None,
                                  departmentId=None):
        #TODO:还需要完善此方法
        if not departmentId:
            departmentId = ''

        myrecordCount = 0
        myrecordCount, dt = UserSerivce.SearchByPage(
            self, userInfo, permissionScopeCode, searchValue, roleIds, enabled,
            auditStates, departmentId, pageIndex, pageSize)

        if showRole:
            #这里是获取角色列表
            dataTableRole = RoleService.GetDT(None)
            #友善的显示属于多个角色的功能
            roleName = ''
            for user in dt:
                roleName = ''
                roleIds = UserRoleService.GetRoleIds(user['ID'])
                if roleIds:
                    for i in roleIds:
                        roleName = roleName + dataTableRole.filter(
                            id=i)[0].realname + ", "
                if roleName:
                    roleName = roleName.strip(", ")
                    user['ROLENAME'] = roleName
        return myrecordCount, dt