aboutsummaryrefslogtreecommitdiffstats
path: root/modules/structs/repo_collaborator.go
diff options
context:
space:
mode:
authorFlorin Hillebrand <flozzone@gmail.com>2022-04-29 14:24:38 +0200
committerGitHub <noreply@github.com>2022-04-29 14:24:38 +0200
commitad6d08d155c67d6d3833d2961ed0fd5a2ba1ff88 (patch)
tree4b951ae25ad9118d31a5077f7f3d24b19efcfc5c /modules/structs/repo_collaborator.go
parente5c6c001c5f5299a63b4ccbd7aaeea486d6b5c53 (diff)
downloadgitea-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 'modules/structs/repo_collaborator.go')
-rw-r--r--modules/structs/repo_collaborator.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/structs/repo_collaborator.go b/modules/structs/repo_collaborator.go
index 2b4fa390d2..2f9c8992a1 100644
--- a/modules/structs/repo_collaborator.go
+++ b/modules/structs/repo_collaborator.go
@@ -8,3 +8,10 @@ package structs
type AddCollaboratorOption struct {
Permission *string `json:"permission"`
}
+
+// RepoCollaboratorPermission to get repository permission for a collaborator
+type RepoCollaboratorPermission struct {
+ Permission string `json:"permission"`
+ RoleName string `json:"role_name"`
+ User *User `json:"user"`
+}