mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-27367] fix ldap group decoding in client (#15192)
Summary
The data returned by the get ldap groups api endpoint was being decoded incorrectly in the Go client.
Ticket Link
https://mattermost.atlassian.net/browse/MM-27367
This commit is contained in:
@@ -3875,7 +3875,19 @@ func (c *Client4) GetLdapGroups() ([]*Group, *Response) {
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
return GroupsFromJson(r.Body), BuildResponse(r)
|
||||
responseData := struct {
|
||||
Count int `json:"count"`
|
||||
Groups []*Group `json:"groups"`
|
||||
}{}
|
||||
if err := json.NewDecoder(r.Body).Decode(&responseData); err != nil {
|
||||
appErr := NewAppError("Api4.GetLdapGroups", "api.marshal_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, BuildErrorResponse(r, appErr)
|
||||
}
|
||||
for i := range responseData.Groups {
|
||||
responseData.Groups[i].DisplayName = *responseData.Groups[i].Name
|
||||
}
|
||||
|
||||
return responseData.Groups, BuildResponse(r)
|
||||
}
|
||||
|
||||
// LinkLdapGroup creates or undeletes a Mattermost group and associates it to the given LDAP group DN.
|
||||
|
||||
Reference in New Issue
Block a user