Adds the endpoints and store logic to get groups by team and by channel (#10502)

* Adds the endpoints and store logic to get groups by team and by channel

* Remove TODO comments

* Fix unit tests
Этот коммит содержится в:
Miguel de la Cruz
2019-04-02 21:02:51 +01:00
коммит произвёл GitHub
родитель 25fd962016
Коммит 2ce48aa6d1
15 изменённых файлов: 777 добавлений и 38 удалений

Просмотреть файл

@@ -3290,6 +3290,30 @@ func (c *Client4) UnlinkLdapGroup(dn string) (*Group, *Response) {
return GroupFromJson(r.Body), BuildResponse(r)
}
// GetLdapGroupsByChannel retrieves the Mattermost Groups associated with a given channel
func (c *Client4) GetGroupsByChannel(channelId string, page, perPage int) ([]*Group, *Response) {
path := fmt.Sprintf("%s/groups?page=%v&per_page=%v", c.GetChannelRoute(channelId), page, perPage)
r, appErr := c.DoApiGet(path, "")
if appErr != nil {
return nil, BuildErrorResponse(r, appErr)
}
defer closeBody(r)
return GroupsFromJson(r.Body), BuildResponse(r)
}
// GetLdapGroupsByTeam retrieves the Mattermost Groups associated with a given team
func (c *Client4) GetGroupsByTeam(teamId string, page, perPage int) ([]*Group, *Response) {
path := fmt.Sprintf("%s/groups?page=%v&per_page=%v", c.GetTeamRoute(teamId), page, perPage)
r, appErr := c.DoApiGet(path, "")
if appErr != nil {
return nil, BuildErrorResponse(r, appErr)
}
defer closeBody(r)
return GroupsFromJson(r.Body), BuildResponse(r)
}
// Audits Section
// GetAudits returns a list of audits for the whole system.