Skip to content
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

Conversation

imtayadeway
Copy link
Contributor

@imtayadeway imtayadeway commented Feb 3, 2017

This is a two part move:

  1. Allow collection-specific resource actions

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.

  1. Move role identifiers to collection-specific section

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.

@miq-bot add-label api, refactoring, enhancement
@miq-bot assign @abellotti

@@ -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)
Copy link
Member

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.
@imtayadeway imtayadeway force-pushed the api/allow-collection-specific-subresource-config branch from 583e0a9 to f948fed Compare February 8, 2017 18:52
@miq-bot
Copy link
Member

miq-bot commented Feb 8, 2017

Checked commits imtayadeway/manageiq@ed579a7~...f948fed with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks good. 👍

@abellotti
Copy link
Member

Much nicer !! Thanks @imtayadeway for the update 🎵

@abellotti abellotti merged commit 6001c08 into ManageIQ:master Feb 8, 2017
@abellotti abellotti added this to the Sprint 54 Ending Feb 13, 2017 milestone Feb 8, 2017
:identifier: vm_snapshot_delete
:delete:
- :name: delete
:identifier: vm_snapshot_delete
Copy link
Member

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 🎵

@imtayadeway imtayadeway deleted the api/allow-collection-specific-subresource-config branch February 13, 2017 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants