diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-03-29 21:11:40 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-03-29 21:11:40 -0400 |
commit | 6ac87d82e38c83e3b9b3bd12c3122e047f0110b1 (patch) | |
tree | aa3f0f8f41df7c987f8bb62756ca3d8259ecbaa1 /model/client4.go | |
parent | a4764a5c10ec59820eec7338d97be48d41c1a4d6 (diff) | |
download | chat-6ac87d82e38c83e3b9b3bd12c3122e047f0110b1.tar.gz chat-6ac87d82e38c83e3b9b3bd12c3122e047f0110b1.tar.bz2 chat-6ac87d82e38c83e3b9b3bd12c3122e047f0110b1.zip |
PLT-2713 Added ability for admins to list users not in any team (#5844)
* PLT-2713 Added ability for admins to list users not in any team
* Updated style of unit test
Diffstat (limited to 'model/client4.go')
-rw-r--r-- | model/client4.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index c3697e3c9..27f8328f4 100644 --- a/model/client4.go +++ b/model/client4.go @@ -500,6 +500,17 @@ func (c *Client4) GetUsersNotInChannel(teamId, channelId string, page int, perPa } } +// GetUsersWithoutTeam returns a page of users on the system that aren't on any teams. Page counting starts at 0. +func (c *Client4) GetUsersWithoutTeam(page int, perPage int, etag string) ([]*User, *Response) { + query := fmt.Sprintf("?without_team=1&page=%v&per_page=%v", page, perPage) + if r, err := c.DoApiGet(c.GetUsersRoute()+query, etag); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return UserListFromJson(r.Body), BuildResponse(r) + } +} + // GetUsersByIds returns a list of users based on the provided user ids. func (c *Client4) GetUsersByIds(userIds []string) ([]*User, *Response) { if r, err := c.DoApiPost(c.GetUsersRoute()+"/ids", ArrayToJson(userIds)); err != nil { |