diff options
Diffstat (limited to 'api4/user.go')
-rw-r--r-- | api4/user.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/api4/user.go b/api4/user.go index 4eb4479c2..298c5cc8d 100644 --- a/api4/user.go +++ b/api4/user.go @@ -266,6 +266,7 @@ func setProfileImage(c *Context, w http.ResponseWriter, r *http.Request) { func getUsers(c *Context, w http.ResponseWriter, r *http.Request) { inTeamId := r.URL.Query().Get("in_team") + notInTeamId := r.URL.Query().Get("not_in_team") inChannelId := r.URL.Query().Get("in_channel") notInChannelId := r.URL.Query().Get("not_in_channel") @@ -285,6 +286,18 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) { } profiles, err = app.GetUsersNotInChannelPage(inTeamId, notInChannelId, c.Params.Page, c.Params.PerPage, c.IsSystemAdmin()) + } else if len(notInTeamId) > 0 { + if !app.SessionHasPermissionToTeam(c.Session, notInTeamId, model.PERMISSION_VIEW_TEAM) { + c.SetPermissionError(model.PERMISSION_VIEW_TEAM) + return + } + + etag = app.GetUsersNotInTeamEtag(inTeamId) + if HandleEtag(etag, "Get Users Not in Team", w, r) { + return + } + + profiles, err = app.GetUsersNotInTeamPage(notInTeamId, c.Params.Page, c.Params.PerPage, c.IsSystemAdmin()) } else if len(inTeamId) > 0 { if !app.SessionHasPermissionToTeam(c.Session, inTeamId, model.PERMISSION_VIEW_TEAM) { c.SetPermissionError(model.PERMISSION_VIEW_TEAM) |