# 权限管理
# 查询目录权限列表
返回项目下指定目录的权限列表,需要有当前目录或上级目录的审批人权限
GET /api/v3/svn/projects/:id/authority
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径project_full_path |
| dir_path | string | 目录路径查询根目录用 / 表示 |
返回值:
{
"svn_project_path": {
"id": 282823,
"path": "/",
"is_shield_parent_dir_permission": false
},
"approver_users": [
{
"id": 758,
"username": "git",
"web_url": "https://git.tencent.com/u/git",
"name": "1111",
"state": "active",
"avatar_url": "https://git.tencent.com/uploads/user/avatar/758/thumb_0-0-200-200_410246bc5a144dcb8ab3170aa2fc7815.png"
}],
"read_write_users": [],
"read_only_users": [],
"approver_user_groups": [],
"read_only_user_groups": [],
"read_write_user_groups": []
}
# 获取用户在某项目中的权限列表
获取一个用户在某个项目中的权限列表,调用者需要在当前项目至少一个目录中有读以上或审批人权限或对项目有 master 及以上的权限
GET /api/v3/svn/projects/:id/authority_member
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径project_full_path |
| username | string(必填) | 用户名 |
| permission | string(可选) | 权限(r rw approver 三者之一) |
| dir_path | string(可选) | 目录名,支持模糊搜索 |
| page | integer(可选) | 分页(默认值:1) |
| per_page | integer(可选) | 默认页面大小(默认值: 20,最大值: 200) |
返回值:
[
{
"dir_path": "/document/j",
"permissions": [
"approver",
"r"
]
},
{
"dir_path": "/document/m",
"permissions": [
"approver",
"rw"
]
}
]
# 查询一个用户在某个项目中对某些目录的权限(包括继承)
获取一个用户在某个项目中对某些目录的权限(包括继承),调用者需要在当前项目至少一个目录中有读以上或审批人权限或对项目有 master 及以上的权限
GET /api/v3/projects/:id/authority/user
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径project_full_path |
| username | string(必填) | 用户名 |
| dir_paths | array of string(必填) | 目录名 |
返回值:
[
{
"dir_path": "/document/j",
"permissions": [
"approver",
"r"
]
},
{
"dir_path": "/document/m",
"permissions": [
"approver",
"rw"
]
}
]
# 新建目录权限
在项目下为没有设置权限的目录设置权限,需要有当前目录或上级目录的审批人权限
POST /api/v3/svn/projects/:id/authority
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径project_full_path |
| dir_path | string | 目录路径 |
| is_shield_parent_dir_permission | boolean(可选) | 是否屏蔽父权限 默认为false |
| approver_users | array of string(可选) | 用户名列表 审批人权限 |
| read_only_users | array of string(可选) | 用户名列表 只读权限 |
| read_write_users | array of string(可选) | 用户名列表 读写权限 |
| approver_user_groups | array of string(可选) | 用户组名列表 审批人权限 |
| read_only_user_groups | array of string(可选) | 用户组名列表 只读权限 |
| read_write_user_groups | array of string(可选) | 用户组名列表 读写权限 |
| expired_at | yyyy-MM-ddZ(可选) | 过期时间要比当前时间往后,精确到天,UTC 时间,例如 2019-03-25+0000,如果非零时区时间,例如:2019-03-25+0800,那么会被转化为 UTC 时间,实际到期时间为 2019-03-24 |
返回值:
200 或其他相关状态码,返回值为空
# 修改目录权限
修改指定目录的权限,需要有当前目录或上级目录的审批人权限
PUT /api/v3/svn/projects/:id/authority
参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| id | integer 或 string | 项目 ID 或 项目全路径project_full_path |
| dir_path | string | 目录路径 |
| is_shield_parent_dir_permission | boolean(可选) | 是否屏蔽父权限 |
| modify_sub_dir_approver | boolean(可选) | 修改子目录审批人权限 默认为 false |
| add_approver_users | array of string(可选) | 增加的用户名列表 审批人权限 |
| delete_approver_users | array of string(可选) | 删除的用户名列表 审批人权限 |
| approver_expired_at_effected_users | array of string(可选) | 权限过期时间生效的用户名列表 审批人权限 |
| add_read_only_users | array of string(可选) | 增加的用户名列表 只读权限 |
| delete_read_only_users | array of string(可选) | 删除的用户名列表 只读权限 |
| read_only_expired_at_effected_users | array of string(可选) | 权限过期时间生效的用户名列表 只读权限 |
| add_read_write_users | array of string(可选) | 增加的用户名列表 读写权限 |
| delete_read_write_users | array of string(可选) | 删除的用户名列表 读写权限 |
| read_write_expired_at_effected_users | array of string(可选) | 权限过期时间生效的用户名列表 读写权限 |
| add_approver_user_groups | array of string(可选) | 增加的用户组名列表 审批人权限 |
| delete_approver_user_groups | array of string(可选) | 删除的用户组名列表 审批人权限 |
| approver_expired_at_effected_user_groups | array of string(可选) | 权限过期时间生效的用户组名列表 审批人权限 |
| add_read_only_user_groups | array of string(可选) | 增加的用户组名列表 只读权限 |
| delete_read_only_user_groups | array of string(可选) | 删除的用户组名列表 只读权限 |
| read_only_expired_at_effected_user_groups | array of string(可选) | 权限过期时间生效的用户组名列表 只读权限 |
| add_read_write_user_groups | array of string(可选) | 增加的用户组名列表 读写权限 |
| delete_read_write_user_groups | array of string(可选) | 权限过期时间生效的用户组名列表 读写权限 |
| read_write_expired_at_effected_user_groups | array of string(可选) | 权限过期时间生效的用户组名列表 读写权限 |
| expired_at | yyyy-MM-ddZ(可选) | 要比当前时间往后,精确到天,UTC 时间,例如 2019-03-25+0000,如果非零时区时间,例如:2019-03-25+0800,那么会被转化为 UTC 时间,实际到期时间为 2019-03-24 |
| reason | string(可选) | 操作理由备注,xxxx |
返回值:
200 或其他相关状态码,返回值为空