UpdateOrganizationMemberRoles grants the userID the specified roles in an org. Include ALL roles the user has.
(ctx context.Context, organizationID uuid.UUID, user string, req UpdateRoles)
| 854 | // UpdateOrganizationMemberRoles grants the userID the specified roles in an org. |
| 855 | // Include ALL roles the user has. |
| 856 | func (c *Client) UpdateOrganizationMemberRoles(ctx context.Context, organizationID uuid.UUID, user string, req UpdateRoles) (OrganizationMember, error) { |
| 857 | res, err := c.Request(ctx, http.MethodPut, fmt.Sprintf("/api/v2/organizations/%s/members/%s/roles", organizationID, user), req) |
| 858 | if err != nil { |
| 859 | return OrganizationMember{}, err |
| 860 | } |
| 861 | defer res.Body.Close() |
| 862 | if res.StatusCode != http.StatusOK { |
| 863 | return OrganizationMember{}, ReadBodyAsError(res) |
| 864 | } |
| 865 | var member OrganizationMember |
| 866 | return member, json.NewDecoder(res.Body).Decode(&member) |
| 867 | } |
| 868 | |
| 869 | // UserRoles returns all roles the user has |
| 870 | func (c *Client) UserRoles(ctx context.Context, user string) (UserRoles, error) { |