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)
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)
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)
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)