diff options
author | Florin Hillebrand <flozzone@gmail.com> | 2022-04-29 14:24:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 14:24:38 +0200 |
commit | ad6d08d155c67d6d3833d2961ed0fd5a2ba1ff88 (patch) | |
tree | 4b951ae25ad9118d31a5077f7f3d24b19efcfc5c /templates | |
parent | e5c6c001c5f5299a63b4ccbd7aaeea486d6b5c53 (diff) | |
download | gitea-ad6d08d155c67d6d3833d2961ed0fd5a2ba1ff88.tar.gz gitea-ad6d08d155c67d6d3833d2961ed0fd5a2ba1ff88.zip |
Add API to query collaborators permission for a repository (#18761)
Targeting #14936, #15332
Adds a collaborator permissions API endpoint according to GitHub API: https://docs.github.com/en/rest/collaborators/collaborators#get-repository-permissions-for-a-user to retrieve a collaborators permissions for a specific repository.
### Checks the repository permissions of a collaborator.
`GET` `/repos/{owner}/{repo}/collaborators/{collaborator}/permission`
Possible `permission` values are `admin`, `write`, `read`, `owner`, `none`.
```json
{
"permission": "admin",
"role_name": "admin",
"user": {}
}
```
Where `permission` and `role_name` hold the same `permission` value and `user` is filled with the user API object. Only admins are allowed to use this API endpoint.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/swagger/v1_json.tmpl | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index d57a3a580b..3e4813f22c 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -3129,6 +3129,52 @@ } } }, + "/repos/{owner}/{repo}/collaborators/{collaborator}/permission": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get repository permissions for a user", + "operationId": "repoGetRepoPermissions", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the collaborator", + "name": "collaborator", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/RepoCollaboratorPermission" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/repos/{owner}/{repo}/commits": { "get": { "produces": [ @@ -17451,6 +17497,24 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "RepoCollaboratorPermission": { + "description": "RepoCollaboratorPermission to get repository permission for a collaborator", + "type": "object", + "properties": { + "permission": { + "type": "string", + "x-go-name": "Permission" + }, + "role_name": { + "type": "string", + "x-go-name": "RoleName" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "RepoCommit": { "type": "object", "title": "RepoCommit contains information of a commit in the context of a repository.", @@ -19126,6 +19190,12 @@ } } }, + "RepoCollaboratorPermission": { + "description": "RepoCollaboratorPermission", + "schema": { + "$ref": "#/definitions/RepoCollaboratorPermission" + } + }, "Repository": { "description": "Repository", "schema": { |