From 0c4078b6b05b4b436c459c4f58faa5302ace8e12 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Tue, 5 Jun 2018 12:41:03 +0100 Subject: MM-9730 & MM-9729: Missing Server PRs (#8908) * MM-9730: API endpoint to update scheme-derived roles of TeamMembers. * MM-9729: API to update scheme-derived roles of ChannelMembers. --- model/client4.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'model/client4.go') diff --git a/model/client4.go b/model/client4.go index c2b6ba948..fb4d1375c 100644 --- a/model/client4.go +++ b/model/client4.go @@ -1320,6 +1320,16 @@ func (c *Client4) UpdateTeamMemberRoles(teamId, userId, newRoles string) (bool, } } +// UpdateTeamMemberSchemeRoles will update the scheme-derived roles on a team for a user. +func (c *Client4) UpdateTeamMemberSchemeRoles(teamId string, userId string, schemeRoles *SchemeRoles) (bool, *Response) { + if r, err := c.DoApiPut(c.GetTeamMemberRoute(teamId, userId)+"/schemeRoles", schemeRoles.ToJson()); err != nil { + return false, BuildErrorResponse(r, err) + } else { + defer closeBody(r) + return CheckStatusOK(r), BuildResponse(r) + } +} + // UpdateTeam will update a team. func (c *Client4) UpdateTeam(team *Team) (*Team, *Response) { if r, err := c.DoApiPut(c.GetTeamRoute(team.Id), team.ToJson()); err != nil { @@ -1849,6 +1859,16 @@ func (c *Client4) UpdateChannelRoles(channelId, userId, roles string) (bool, *Re } } +// UpdateChannelMemberSchemeRoles will update the scheme-derived roles on a channel for a user. +func (c *Client4) UpdateChannelMemberSchemeRoles(channelId string, userId string, schemeRoles *SchemeRoles) (bool, *Response) { + if r, err := c.DoApiPut(c.GetChannelMemberRoute(channelId, userId)+"/schemeRoles", schemeRoles.ToJson()); err != nil { + return false, BuildErrorResponse(r, err) + } else { + defer closeBody(r) + return CheckStatusOK(r), BuildResponse(r) + } +} + // UpdateChannelNotifyProps will update the notification properties on a channel for a user. func (c *Client4) UpdateChannelNotifyProps(channelId, userId string, props map[string]string) (bool, *Response) { if r, err := c.DoApiPut(c.GetChannelMemberRoute(channelId, userId)+"/notify_props", MapToJson(props)); err != nil { -- cgit v1.2.3-1-g7c22