MCPcopy Index your code
hub / github.com/cloudfoundry/cli / SetOrgRoleByUsername

Method SetOrgRoleByUsername

cf/api/users.go:255–267  ·  view source on GitHub ↗
(username string, orgGUID string, role models.Role)

Source from the content-addressed store, hash-verified

253}
254
255func (repo CloudControllerUserRepository) SetOrgRoleByUsername(username string, orgGUID string, role models.Role) error {
256 rolePath, err := rolePath(role)
257 if err != nil {
258 return err
259 }
260
261 path := fmt.Sprintf("%s/v2/organizations/%s/%s", repo.config.APIEndpoint(), orgGUID, rolePath)
262 err = repo.callAPI("PUT", path, usernamePayload(username))
263 if err != nil {
264 return err
265 }
266 return repo.assocUserWithOrgByUsername(username, orgGUID, nil)
267}
268
269func (repo CloudControllerUserRepository) callAPI(verb, path string, body io.ReadSeeker) (err error) {
270 request, err := repo.ccGateway.NewRequest(verb, path, repo.config.AccessToken(), body)

Callers

nothing calls this directly

Calls 5

callAPIMethod · 0.95
rolePathFunction · 0.85
usernamePayloadFunction · 0.85
APIEndpointMethod · 0.65

Tested by

no test coverage detected