Skip to content

Conversation

@philippthun
Copy link
Member

  • Allow POST only when type = organization. Otherwise fail with 422 Unprocessable Entity.
  • Ensure the target plan already has visibility type organization. If the plan’s visibility type is not organization, the request fails with 422 Unprocessable Entity.

Fixes #4606

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

- Allow POST only when type = organization. Otherwise fail with 422
  Unprocessable Entity.
- Ensure the target plan already has visibility type organization. If
  the plan’s visibility type is not organization, the request fails with
  422 Unprocessable Entity.
end

def update(service_plan, message, append_organizations: false)
type = message.type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe there is a better name for this?

Comment on lines +81 to 87
def visibility_type_org?(service_plan)
service_plan.visibility_type == VCAP::CloudController::ServicePlanVisibilityTypes::ORGANIZATION
end

def org?(type)
type == VCAP::CloudController::ServicePlanVisibilityTypes::ORGANIZATION
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine this into a single method and use the same pattern for visibility_type_space?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restrict POST /v3/service_plans/:guid/visibility to only support appending orgs (and not changing visibility type)

2 participants