Fixing issue bind asg to space with non admin user #486
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#405
First of all let me say that the concept of moving the user attributes (developers, managers, ...) from the cf space resource to a separate cf space users resource has a major drawback: If you use a user for your terraforming that is not an admin (e.g. only org admin) this user needs to be assigned as space developer to the new space right after creation. Otherwise asgs can't be assigned.
Second in order to manage asgs for a space with a non admin user you can't use the path
/v2/security_groups/:asg_guid/spaces/:s_guid
-> Unauthorized
but you need to use
/v2/spaces/:s_guid/asgs/[staging_]security_groups/:asg_guid
-> works if your user is space developer for the space
So I changed the code accordingly. Now something like the following snippet works (gives a warning)