aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-05 02:33:36 +0800
committertechknowlogick <techknowlogick@gitea.io>2019-08-04 14:33:36 -0400
commit5b902e2368fdb67eda4ba033f7167fadf72e4350 (patch)
tree517c89ca14e749962d8c8b221a6ef5188d764d1d /routers
parent7b2a39c78bbda57cd76c5c01af4904bf6a709a7d (diff)
downloadgitea-5b902e2368fdb67eda4ba033f7167fadf72e4350.tar.gz
gitea-5b902e2368fdb67eda4ba033f7167fadf72e4350.zip
add pagination for admin api get orgs and fix only list public orgs bug (#7742)
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/admin/org.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index d740647cd4..c90e739626 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -82,6 +82,15 @@ func GetAllOrgs(ctx *context.APIContext) {
// summary: List all organizations
// produces:
// - application/json
+ // parameters:
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results, maximum page size is 50
+ // type: integer
// responses:
// "200":
// "$ref": "#/responses/OrganizationList"
@@ -90,7 +99,9 @@ func GetAllOrgs(ctx *context.APIContext) {
users, _, err := models.SearchUsers(&models.SearchUserOptions{
Type: models.UserTypeOrganization,
OrderBy: models.SearchOrderByAlphabetically,
- PageSize: -1,
+ Page: ctx.QueryInt("page"),
+ PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")),
+ Private: true,
})
if err != nil {
ctx.Error(500, "SearchOrganizations", err)