teams: moved logic for searchteams to backend

This commit is contained in:
Hugo Häggmark
2019-03-13 14:05:08 +01:00
committed by Leonard Gram
parent 782b5b6a3a
commit b60e71c28b
4 changed files with 13 additions and 9 deletions

View File

@ -81,7 +81,7 @@ func DeleteTeamByID(c *m.ReqContext) Response {
}
// GET /api/teams/search
func SearchTeams(c *m.ReqContext) Response {
func (hs *HTTPServer) SearchTeams(c *m.ReqContext) Response {
perPage := c.QueryInt("perpage")
if perPage <= 0 {
perPage = 1000
@ -92,7 +92,7 @@ func SearchTeams(c *m.ReqContext) Response {
}
var userIdFilter int64
if c.QueryBool("showMine") {
if hs.Cfg.EditorsCanAdmin && c.OrgRole != m.ROLE_ADMIN {
userIdFilter = c.SignedInUser.UserId
}