aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/api.go
diff options
context:
space:
mode:
authorRomain <romdum@users.noreply.github.com>2021-10-12 12:47:19 +0200
committerGitHub <noreply@github.com>2021-10-12 12:47:19 +0200
commitd0a681fbc3fb626adcddbbb13f8c96c0bbd72c02 (patch)
treeed807f45d54993e20f63af81d9d964ddc2f258fe /routers/api/v1/api.go
parent7b8723158e2a50834617f47b07c29f5436fede6d (diff)
downloadgitea-d0a681fbc3fb626adcddbbb13f8c96c0bbd72c02.tar.gz
gitea-d0a681fbc3fb626adcddbbb13f8c96c0bbd72c02.zip
[API] Add endpount to get user org permissions (#17232)
* Add endpoint * Add swagger response + generate swagger * Stop execution if user / org is not found * Add tests Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/api/v1/api.go')
-rw-r--r--routers/api/v1/api.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 0a967e3c5a..d11bbf3c06 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -973,7 +973,10 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
// Organizations
m.Get("/user/orgs", reqToken(), org.ListMyOrgs)
- m.Get("/users/{username}/orgs", org.ListUserOrgs)
+ m.Group("/users/{username}/orgs", func() {
+ m.Get("", org.ListUserOrgs)
+ m.Get("/{org}/permissions", reqToken(), org.GetUserOrgsPermissions)
+ })
m.Post("/orgs", reqToken(), bind(api.CreateOrgOption{}), org.Create)
m.Get("/orgs", org.GetAll)
m.Group("/orgs/{org}", func() {