diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/authorization.go | 7 | ||||
-rw-r--r-- | model/client4.go | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/model/authorization.go b/model/authorization.go index d49406e47..1f6f34a2a 100644 --- a/model/authorization.go +++ b/model/authorization.go @@ -57,6 +57,7 @@ var PERMISSION_CREATE_TEAM *Permission var PERMISSION_MANAGE_TEAM *Permission var PERMISSION_IMPORT_TEAM *Permission var PERMISSION_VIEW_TEAM *Permission +var PERMISSION_LIST_USERS_WITHOUT_TEAM *Permission // General permission that encompases all system admin functions // in the future this could be broken up to allow access to some @@ -286,6 +287,11 @@ func InitalizePermissions() { "authentication.permissions.view_team.name", "authentication.permissions.view_team.description", } + PERMISSION_LIST_USERS_WITHOUT_TEAM = &Permission{ + "list_users_without_team", + "authentication.permisssions.list_users_without_team.name", + "authentication.permisssions.list_users_without_team.description", + } } func InitalizeRoles() { @@ -400,6 +406,7 @@ func InitalizeRoles() { PERMISSION_DELETE_OTHERS_POSTS.Id, PERMISSION_CREATE_TEAM.Id, PERMISSION_ADD_USER_TO_TEAM.Id, + PERMISSION_LIST_USERS_WITHOUT_TEAM.Id, }, ROLE_TEAM_USER.Permissions..., ), 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 { |