diff options
Diffstat (limited to 'routers/api/v1/admin/user.go')
-rw-r--r-- | routers/api/v1/admin/user.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index cff8ae4850..e35beffc92 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -1,4 +1,5 @@ // Copyright 2015 The Gogs Authors. All rights reserved. +// Copyright 2019 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -291,3 +292,27 @@ func DeleteUserPublicKey(ctx *context.APIContext) { ctx.Status(204) } + +//GetAllUsers API for getting information of all the users +func GetAllUsers(ctx *context.APIContext) { + // swagger:operation GET /admin/users admin adminGetAllUsers + // --- + // summary: List all users + // produces: + // - application/json + // responses: + // "200": + // "$ref": "#/responses/UserList" + // "403": + // "$ref": "#/responses/forbidden" + users, _, err := models.SearchUsers(&models.SearchUserOptions{ + Type: models.UserTypeIndividual, + OrderBy: models.SearchOrderByAlphabetically, + PageSize: -1, + }) + if err != nil { + ctx.Error(500, "SearchUsers", err) + return + } + ctx.JSON(200, &users) +} |