Group and project access requests API
- Valid access levels
- List access requests for a group or project
- Request access to a group or project
- Approve an access request
- Deny an access request
Group and project access requests API
注意:此功能是在 GitLab 8.11 中引入的
Valid access levels
访问级别在Gitlab::Access
模块中定义. 当前,这些级别被认可:
- 无法访问(
0
) - 宾客(
10
) - 记者(
20
) - 显影剂(
30
) - 养护者(
40
) - 所有者(
50
)-仅对组有效
List access requests for a group or project
获取认证用户可见的访问请求列表.
GET /groups/:id/access_requests
GET /projects/:id/access_requests
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
请求示例:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/:id/access_requests"
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:id/access_requests"
响应示例:
[ { "id": 1, "username": "raymond_smith", "name": "Raymond Smith", "state": "active", "created_at": "2012-10-22T14:13:35Z", "requested_at": "2012-10-22T14:13:35Z" }, { "id": 2, "username": "john_doe", "name": "John Doe", "state": "active", "created_at": "2012-10-22T14:13:35Z", "requested_at": "2012-10-22T14:13:35Z" } ]
Request access to a group or project
请求已验证用户访问组或项目.
POST /groups/:id/access_requests
POST /projects/:id/access_requests
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
请求示例:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/:id/access_requests"
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:id/access_requests"
响应示例:
{ "id": 1, "username": "raymond_smith", "name": "Raymond Smith", "state": "active", "created_at": "2012-10-22T14:13:35Z", "requested_at": "2012-10-22T14:13:35Z" }
Approve an access request
批准给定用户的访问请求.
PUT /groups/:id/access_requests/:user_id/approve
PUT /projects/:id/access_requests/:user_id/approve
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
user_id |
integer | yes | 访问请求者的用户标识 |
access_level |
integer | no | 有效的访问级别(默认值: 30 ,开发人员访问级别) |
请求示例:
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/:id/access_requests/:user_id/approve?access_level=20"
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:id/access_requests/:user_id/approve?access_level=20"
响应示例:
{ "id": 1, "username": "raymond_smith", "name": "Raymond Smith", "state": "active", "created_at": "2012-10-22T14:13:35Z", "access_level": 20 }
Deny an access request
拒绝给定用户的访问请求.
DELETE /groups/:id/access_requests/:user_id
DELETE /projects/:id/access_requests/:user_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
user_id |
integer | yes | 访问请求者的用户标识 |
请求示例:
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/:id/access_requests/:user_id"
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:id/access_requests/:user_id"