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

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

Closed
wants to merge 1 commit into from

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Aug 19, 2024

Extracted from #23140

Goal

When asking a read only model Model#supports?(:delete) (or update) 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

making the read_only logic more consistent
@kbrock kbrock changed the title add supports for read_only models ReadOnly models respond false to supports?(:update) Aug 19, 2024
@miq-bot
Copy link
Member

miq-bot commented Aug 19, 2024

Checked commit kbrock@d210d9a 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. 🍰

@Fryguy
Copy link
Member

Fryguy commented Aug 19, 2024

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
Copy link
Member Author

kbrock commented Aug 20, 2024

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

We have ReadOnly for the following models:

  • miq_widget
  • miq_user_role
  • miq_policy
  • miq_policy_set
  • condition
  • classification
  • miq_alert

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
Copy link
Member Author

kbrock commented Aug 20, 2024

just cleaning things up. not worth it right now

@kbrock kbrock closed this Aug 20, 2024
@kbrock kbrock deleted the read_only_no_support_delete branch August 20, 2024 15:26
@Fryguy
Copy link
Member

Fryguy commented Aug 22, 2024

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.

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.

3 participants