ManageIQ / manageiq

ManageIQ Open-Source Management Platform
https://manageiq.org
Apache License 2.0
1.35k stars 896 forks source link

ReadOnly models respond false to supports?(:update) #23161

Closed kbrock closed 1 month ago

kbrock commented 1 month ago

Extracted from https://github.com/ManageIQ/manageiq/pull/23140

Goal

When asking a read only model Model#supports?(:delete) (orupdate) it will correctly respond no.

Yes, we did have 2 false positives adding read_only behavior to models that used that column for another meaning. But these were resolved a long time ago.

Previous PRs that addressed ReadOnly concerns

miq-bot commented 1 month ago

Checked commit https://github.com/kbrock/manageiq/commit/d210d9ac49f421867773f765ea07c53b927f4096 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint 1 file checked, 0 offenses detected Everything looks fine. :cake:

Fryguy commented 1 month ago

I'm confused - read_only doesn't mean that we can't do things on a provider - it just means we can't change things in the database record itself. Can you give a specific model example of where this applies?

kbrock commented 1 month ago

ok, so maybe this was an old branch with a dumb idea.

We have ReadOnly for the following models:

I thought we used that to show whether an action was supported in the ui. So if the miq_widget.supports?(:update) == false if miq_widget.read_only?

kbrock commented 1 month ago

just cleaning things up. not worth it right now

Fryguy commented 1 month ago

I thought we used that to show whether an action was supported in the ui.

Yeah you might be right? I think there was some conflating of "provider supports" type things and "miq supports" type things and that's why we're in this state.