MCPcopy Index your code
hub / github.com/coder/coder / UpdateOrganizationMemberRoles

Method UpdateOrganizationMemberRoles

codersdk/users.go:856–867  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

854// UpdateOrganizationMemberRoles grants the userID the specified roles in an org.
855// Include ALL roles the user has.
856func (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
870func (c *Client) UserRoles(ctx context.Context, user string) (UserRoles, error) {

Callers 6

TestWatchChatGitAuthzFunction · 0.80
createAnotherUserRetryFunction · 0.80
TestAssignCustomOrgRolesFunction · 0.80
TestGrantSiteRolesFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 4

TestWatchChatGitAuthzFunction · 0.64
TestAssignCustomOrgRolesFunction · 0.64
TestGrantSiteRolesFunction · 0.64