MM-15162: Changes for LDAP groups removals. (#10701)
* MM-15162: Changes for LDAP groups removals phase. * MM-15162: Adds missing translation. * MM-15162: Fixes tests. * MM-15162: Removes some confusing branching. * MM-15162: Make permission less restrictive. * MM-15162: Moves counting to the DB tier. * MM-15162: Moves CountGroupsByTeam into own store method. * MM-15162: Adds count to tests. * MM-15162: Fix for wrong cast type. * MM-15162: Fix for possible null SchemeGuest column. * MM-15162: Fixes bug whereby permissions error didn't return. * MM-15162: Changes for LDAP groups removals phase. * MM-15162: Adds missing translation. * MM-15162: Fixes tests. * MM-15162: Removes some confusing branching. * MM-15162: Make permission less restrictive. * MM-15162: Moves counting to the DB tier. * MM-15162: Moves CountGroupsByTeam into own store method. * MM-15162: Adds count to tests. * MM-15162: Fix for wrong cast type. * MM-15162: Fix for possible null SchemeGuest column. * MM-15162: Fixes bug whereby permissions error didn't return. * MM-15162: Adds missing translation blocking enterprise build. * MM-15162: Update to group commands.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
74c7c46a7d
Коммит
480fffd3cc
@@ -3310,7 +3310,7 @@ func (c *Client4) UnlinkLdapGroup(dn string) (*Group, *Response) {
|
||||
return GroupFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetLdapGroupsByChannel retrieves the Mattermost Groups associated with a given channel
|
||||
// GetGroupsByChannel 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, "")
|
||||
@@ -3322,9 +3322,39 @@ func (c *Client4) GetGroupsByChannel(channelId string, page, perPage int) ([]*Gr
|
||||
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)
|
||||
// GetGroupsByTeam retrieves the Mattermost Groups associated with a given team
|
||||
func (c *Client4) GetGroupsByTeam(teamId string, opts GroupSearchOpts) ([]*Group, int, *Response) {
|
||||
path := fmt.Sprintf("%s/groups?q=%v&include_member_count=%v", c.GetTeamRoute(teamId), opts.Q, opts.IncludeMemberCount)
|
||||
if opts.PageOpts != nil {
|
||||
path = fmt.Sprintf("%s&page=%v&per_page=%v", path, opts.PageOpts.Page, opts.PageOpts.PerPage)
|
||||
}
|
||||
r, appErr := c.DoApiGet(path, "")
|
||||
if appErr != nil {
|
||||
return nil, 0, BuildErrorResponse(r, appErr)
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
responseData := struct {
|
||||
Groups []*Group `json:"groups"`
|
||||
Count int `json:"total_group_count"`
|
||||
}{}
|
||||
if err := json.NewDecoder(r.Body).Decode(&responseData); err != nil {
|
||||
appErr := NewAppError("Api4.GetGroupsByTeam", "api.marshal_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, 0, BuildErrorResponse(r, appErr)
|
||||
}
|
||||
|
||||
return responseData.Groups, responseData.Count, BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetGroups retrieves Mattermost Groups
|
||||
func (c *Client4) GetGroups(opts GroupSearchOpts) ([]*Group, *Response) {
|
||||
path := fmt.Sprintf(
|
||||
"%s?include_member_count=%v¬_associated_to_team=%v&q=%v",
|
||||
c.GetGroupsRoute(), opts.IncludeMemberCount, opts.NotAssociatedToTeam, opts.Q,
|
||||
)
|
||||
if opts.PageOpts != nil {
|
||||
path = fmt.Sprintf("%s&page=%v&per_page=%v", path, opts.PageOpts.Page, opts.PageOpts.PerPage)
|
||||
}
|
||||
r, appErr := c.DoApiGet(path, "")
|
||||
if appErr != nil {
|
||||
return nil, BuildErrorResponse(r, appErr)
|
||||
|
||||
Ссылка в новой задаче
Block a user