aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/admin
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-04-15 17:36:59 +0100
committertechknowlogick <matti@mdranta.net>2019-04-15 12:36:59 -0400
commit837116875efc8f27265e884499ecca69ef554014 (patch)
tree78f6b246216be0f98ac32c3e2b35b831cd840eac /routers/api/v1/admin
parent74fc63682c4c14b5c19c46f9d41af1cf4212766f (diff)
downloadgitea-837116875efc8f27265e884499ecca69ef554014.tar.gz
gitea-837116875efc8f27265e884499ecca69ef554014.zip
Return a UserList from /api/v1/admin/users (#6629)
Diffstat (limited to 'routers/api/v1/admin')
-rw-r--r--routers/api/v1/admin/user.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 2e2a7fecb9..609b53874e 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/user"
api "code.gitea.io/sdk/gitea"
)
@@ -319,8 +320,14 @@ func GetAllUsers(ctx *context.APIContext) {
PageSize: -1,
})
if err != nil {
- ctx.Error(500, "SearchUsers", err)
+ ctx.Error(500, "GetAllUsers", err)
return
}
- ctx.JSON(200, &users)
+
+ results := make([]*api.User, len(users))
+ for i := range users {
+ results[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User.IsAdmin)
+ }
+
+ ctx.JSON(200, &results)
}