Skip to content

Commit 73394f4

Browse files
authored
[API] List limited and private orgs if authentificated (#16866)
* fix bug #16785 and similar * code format * CI.restart()
1 parent 06b9d55 commit 73394f4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

routers/api/v1/admin/org.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ func GetAllOrgs(ctx *context.APIContext) {
105105
listOptions := utils.GetListOptions(ctx)
106106

107107
users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
108+
Actor: ctx.User,
108109
Type: models.UserTypeOrganization,
109110
OrderBy: models.SearchOrderByAlphabetically,
110111
ListOptions: listOptions,

routers/api/v1/org/org.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func GetAll(ctx *context.APIContext) {
128128
listOptions := utils.GetListOptions(ctx)
129129

130130
publicOrgs, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
131+
Actor: ctx.User,
131132
ListOptions: listOptions,
132133
Type: models.UserTypeOrganization,
133134
OrderBy: models.SearchOrderByAlphabetically,

routers/api/v1/user/user.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,13 @@ func Search(ctx *context.APIContext) {
5454

5555
listOptions := utils.GetListOptions(ctx)
5656

57-
opts := &models.SearchUserOptions{
57+
users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
5858
Actor: ctx.User,
5959
Keyword: ctx.FormTrim("q"),
6060
UID: ctx.FormInt64("uid"),
6161
Type: models.UserTypeIndividual,
6262
ListOptions: listOptions,
63-
}
64-
65-
users, maxResults, err := models.SearchUsers(opts)
63+
})
6664
if err != nil {
6765
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
6866
"ok": false,

0 commit comments

Comments
 (0)