-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move authorization config for snapshotting to vms section #13761
Move authorization config for snapshotting to vms section #13761
Conversation
331dcf1
to
583e0a9
Compare
lib/api/collection_config.rb
Outdated
@@ -53,12 +53,12 @@ def typed_collection_actions(collection_name, target) | |||
self[collection_name]["#{target}_actions".to_sym] | |||
end | |||
|
|||
def typed_subcollection_actions(collection_name, subcollection_name) | |||
self[collection_name]["#{subcollection_name}_subcollection_actions".to_sym] | |||
def typed_subcollection_actions(collection_name, subcollection_name, target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of changes because of the required parameter, couldn't you make target optional and keep the signature backward compatible ?
Sometimes you have a subcollection whose role depends on the context of the "super"-collection, e.g. tagging vms requires a separate identifier to tagging hosts. This is fine and currently works, but we haven't implemented this correctly for subcollection members. This revision changes the way we look up subcollection role identifiers so that it knows the difference between subcollection and member actions.
This moves the snapshotting identifiers to the `:vms` section of the config, since they are wholly concerned with VMs. When instance snapshotting is implemented, they will need a whole new set of identifiers.
583e0a9
to
f948fed
Compare
Checked commits imtayadeway/manageiq@ed579a7~...f948fed with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Much nicer !! Thanks @imtayadeway for the update 🎵 |
:identifier: vm_snapshot_delete | ||
:delete: | ||
- :name: delete | ||
:identifier: vm_snapshot_delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you double check that spec/requests/api/config_spec.rb's test "contains only valid miq_feature identifiers" also test subresource actions as you have above ? If not, could you create another PR to update that test accordingly ? Thanks 🎵
This is a two part move:
Sometimes you have a subcollection whose role depends on the context
of the "super"-collection, e.g. tagging vms requires a separate
identifier to tagging hosts. This is fine and currently works, but we
haven't implemented this correctly for subcollection members. This
revision changes the way we look up subcollection role identifiers so
that it knows the difference between subcollection and member actions.
This moves the snapshotting identifiers to the
:vms
section of theconfig, since they are wholly concerned with VMs. When instance
snapshotting is implemented, they will need a whole new set of
identifiers.
@miq-bot add-label api, refactoring, enhancement
@miq-bot assign @abellotti