Skip to content

Commit 3ac1f35

Browse files
authored
List limited and private orgs if authenticated on API (#16866) (#16879)
1 parent af1fd56 commit 3ac1f35

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
@@ -106,6 +106,7 @@ func GetAllOrgs(ctx *context.APIContext) {
106106
listOptions := utils.GetListOptions(ctx)
107107

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

routers/api/v1/org/org.go

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

132132
publicOrgs, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
133+
Actor: ctx.User,
133134
ListOptions: listOptions,
134135
Type: models.UserTypeOrganization,
135136
OrderBy: models.SearchOrderByAlphabetically,

routers/api/v1/user/user.go

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

5757
listOptions := utils.GetListOptions(ctx)
5858

59-
opts := &models.SearchUserOptions{
59+
users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
6060
Actor: ctx.User,
6161
Keyword: strings.Trim(ctx.Query("q"), " "),
6262
UID: ctx.QueryInt64("uid"),
6363
Type: models.UserTypeIndividual,
6464
ListOptions: listOptions,
65-
}
66-
67-
users, maxResults, err := models.SearchUsers(opts)
65+
})
6866
if err != nil {
6967
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
7068
"ok": false,

0 commit comments

Comments
 (0)