summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/admin/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/admin/user.go')
-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)
}