예제 #1
0
def ability_index_handler():
    """
    @api {get} /v1/ability 查询 Ability列表
    @apiName GetAbility
    @apiGroup 用户
    @apiDescription 查询Ability列表
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": [
            {
                "handler": "user",
                "id": 1,
                "name": "用户模块"
            }
        ],
        "limit": 99999,
        "message": "ok",
        "offset": 0
    }
    """
    limit, offset = parse_list_args()
    ret = AbilityBusiness.get_ability_class(limit, offset)

    return json_list_render(0, ret, limit, offset)
예제 #2
0
def role_index_handler():
    """
    @api {get} /v1/role 获取 role列表
    @apiName GetRoleList
    @apiGroup 用户
    @apiDescription 查询role列表
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": [
            {
                "id": 4,
                "name": "opt1",
                "status": 0,
                "weight": 2
            },
            {
                "id": 1,
                "name": "admin",
                "status": 0,
                "weight": 1
            }
        ],
        "limit": 99999,
        "message": "ok",
        "offset": 0
    }
    """
    limit, offset = parse_list_args()
    data = RoleBusiness.query_all_json(limit, offset)

    return json_list_render(0, data, limit, offset)
예제 #3
0
def monkey_index_handler():
    limit, offset = parse_list_args()

    monkey_id = request.args.get('monkey_id')

    if monkey_id:
        data = MonkeyBusiness.query_all_json()
        return json_list_render(0, data, limit, offset)

    data = MonkeyBusiness.query_all_json(limit, offset)
    return {"code": 0, "data": data}
예제 #4
0
def monkey_device_status_all_handler():
    limit, offset = parse_list_args()

    monkey_id = request.args.get('monkey_id')

    if monkey_id:
        data = MonkeyDeviceStatusBusiness.query_json_by_monkey_id(monkey_id)
        return json_list_render(0, data, limit, offset)

    monkeys = MonkeyDeviceStatusBusiness.query_all_json(limit, offset)
    return {"code": 0, "data": monkeys}
예제 #5
0
def project_role_handler():
    """
    @api {get} /v1/role/projectrole 获取 所有角色的权限
    @apiName GetAllRole
    @apiGroup 用户
    @apiDescription 获取所有角色的权限
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
    "code": 0,
    "data": [
        {
            "ability": [
                {
                    "id": 6,
                    "name": "执行用例"
                },
                {
                    "id": 4,
                    "name": "编辑模块"
                },
                {
                    "id": 3,
                    "name": "编辑任务"
                },
                {
                    "id": 1,
                    "name": "编辑版本"
                }
            ],
            "comment": "开发",
            "id": 2,
            "name": "dev",
            "status": 0,
            "weight": 1
        },
        {
            "ability": [],
            "comment": "超级管理员",
            "id": 1,
            "name": "admin",
            "status": 0,
            "weight": 1
        }
    ],
    "limit": 99999,
    "message": "ok",
    "offset": 0
    }
    """
    limit, offset = parse_list_args()
    data = RoleBusiness.query_all_json(limit, offset)

    return json_list_render(0, data, limit, offset)
예제 #6
0
def credit_index_handler():
    limit, offset = parse_list_args()

    job_id = request.args.get('job_id')

    if job_id:
        data = JobsRecordBusiness.query_json_by_job_id(job_id)
        return json_list_render(0, data, limit, offset)

    data = JobsRecordBusiness.query_all_json(limit, offset)
    return json_detail_render(0, data)
예제 #7
0
def project_role_list_user():
    """
    @api {get} /v1/user/project_role_list 获取 项目的所有用户列表和角色
    @apiName GetProjectAndRoleListsByUser
    @apiGroup 用户
    @apiDescription 获取项目的所有用户列表和角色
    @apiParam {int} [limit] limit
    @apiParam {int} [offset] offset
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": [
            {
                "nickname": "吴茂澍",
                "project": [
                    {
                        "id": 4,
                        "name": "云测平台66"
                    }
                ],
                "role": [
                    {
                        "comment": "测试",
                        "id": 3,
                        "name": "test"
                    }
                ],
                "userid": 110,
                "username": "******",
                "userweight": 1
            }
        ],
        "limit": 1,
        "message": "ok",
        "offset": 2
    }
    """
    limit, offset = parse_list_args()
    data = UserBusiness.query_user_project_role(limit, offset)

    return json_list_render(0, data, limit, offset)