diff options
author | 6543 <6543@obermui.de> | 2022-09-19 14:02:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-19 20:02:29 +0800 |
commit | c5e88fb03d01b929cfcf17c0a817d75572d44023 (patch) | |
tree | cab1d3ef10068716a833e6f36f830a34350155df /routers/api/v1 | |
parent | c87e6a89da05bcf57cc0b60359915efd008f744f (diff) | |
download | gitea-c5e88fb03d01b929cfcf17c0a817d75572d44023.tar.gz gitea-c5e88fb03d01b929cfcf17c0a817d75572d44023.zip |
[API] teamSearch show teams with no members if user is admin (#21204)
close #21176
Diffstat (limited to 'routers/api/v1')
-rw-r--r-- | routers/api/v1/org/team.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go index c891d0e122..f3e7834a49 100644 --- a/routers/api/v1/org/team.go +++ b/routers/api/v1/org/team.go @@ -759,13 +759,17 @@ func SearchTeam(ctx *context.APIContext) { listOptions := utils.GetListOptions(ctx) opts := &organization.SearchTeamOptions{ - UserID: ctx.Doer.ID, Keyword: ctx.FormTrim("q"), OrgID: ctx.Org.Organization.ID, IncludeDesc: ctx.FormString("include_desc") == "" || ctx.FormBool("include_desc"), ListOptions: listOptions, } + // Only admin is allowd to search for all teams + if !ctx.Doer.IsAdmin { + opts.UserID = ctx.Doer.ID + } + teams, maxResults, err := organization.SearchTeam(opts) if err != nil { log.Error("SearchTeam failed: %v", err) |