aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-08-30 20:00:59 +0200
committerGitHub <noreply@github.com>2021-08-30 14:00:59 -0400
commit73394f435c4a15b9d2ef5449213254f12fb34e1d (patch)
tree5ad44cc1e1938b1c6ed9059b0140314c35ee7b70 /routers
parent06b9d553bc02f88553ced9822c55ae901e2ac28e (diff)
downloadgitea-73394f435c4a15b9d2ef5449213254f12fb34e1d.tar.gz
gitea-73394f435c4a15b9d2ef5449213254f12fb34e1d.zip
[API] List limited and private orgs if authentificated (#16866)
* fix bug #16785 and similar * code format * CI.restart()
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/admin/org.go1
-rw-r--r--routers/api/v1/org/org.go1
-rw-r--r--routers/api/v1/user/user.go6
3 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index f1a766d544..5da87fa7df 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -105,6 +105,7 @@ func GetAllOrgs(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)
users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
+ Actor: ctx.User,
Type: models.UserTypeOrganization,
OrderBy: models.SearchOrderByAlphabetically,
ListOptions: listOptions,
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index 39ce896cd6..cf4c328ebb 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -128,6 +128,7 @@ func GetAll(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)
publicOrgs, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
+ Actor: ctx.User,
ListOptions: listOptions,
Type: models.UserTypeOrganization,
OrderBy: models.SearchOrderByAlphabetically,
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index a5e70de548..535a49d766 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -54,15 +54,13 @@ func Search(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)
- opts := &models.SearchUserOptions{
+ users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
Actor: ctx.User,
Keyword: ctx.FormTrim("q"),
UID: ctx.FormInt64("uid"),
Type: models.UserTypeIndividual,
ListOptions: listOptions,
- }
-
- users, maxResults, err := models.SearchUsers(opts)
+ })
if err != nil {
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
"ok": false,