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

Fixes #31836 - Unclear error message for cvv promotion with bad perrms #9153

Merged

Conversation

ianballou
Copy link
Member

@ianballou ianballou commented Feb 9, 2021

This PR brings back the error message that reports which permissions could be missing that went away with #8956

The root of the issue here is that promote_or_remove_content_views_to_environments has a special relationship to promote_or_remove_content_views. The whole permissions model seems to expect permissions to be separate and not have relationships, which isn't always the case. The PR here does seem like a bit of a workaround, but it also seems to be the least complicated fix at least.

A better long-term solution may be to formally declare these special relationships somehow. I'm not sure if it's worth the time to do that here.

I'm curious to hear if there are ideas about better ways to solve the issue. I'm not sure how this change will interact with other permissions so I'm marking it a draft for now.

To test:

  1. Go through the scenario in the redmine
  2. Test accessing other things with the UI and Hammer to make sure that my new messages doesn't break anything.

@theforeman-bot
Copy link

Issues: #31836

@ianballou ianballou force-pushed the 31836-fix-promote-bad-perms-error branch from 0ade011 to 85839d0 Compare February 15, 2021 19:37
@ianballou ianballou marked this pull request as ready for review February 15, 2021 19:37
Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, works good:

Before:

[vagrant@hammer ~]$ hammer -u test -p changeme content-view version promote --content-view-id 2 --organization-id 1 --to-lifecycle-environment-id 1
Could not promote the content view:
  Could not find content_view_version resource with id 2

With patch:

[vagrant@hammer ~]$ hammer -u test -p changeme content-view version promote --content-view-id 2 --organization-id 1 --to-lifecycle-environment-id 1
Could not promote the content view:
  Could not find content_view_version resource with id 2. Potential missing permissions: promote_or_remove_content_views, promote_or_remove_content_views_to_environments

@ianballou ianballou merged commit 1bba15f into Katello:master Feb 17, 2021
@ianballou ianballou deleted the 31836-fix-promote-bad-perms-error branch February 17, 2021 16:14
jturel pushed a commit to jturel/katello that referenced this pull request Mar 4, 2021
jturel pushed a commit that referenced this pull request Mar 10, 2021
jjeffers pushed a commit to jjeffers/katello that referenced this pull request Mar 15, 2021
@ianballou
Copy link
Member Author

For future reference, the weird permissions relationship between lifecycle environments and content views is rooted here: https://github.com/Katello/katello/blob/master/app/models/katello/authorization/content_view.rb#L24

jturel pushed a commit to jturel/katello that referenced this pull request Apr 30, 2021
…ote a content view with a user that has insufficient permissions

Fixes #31836 - Unclear error message for cvv promotion with bad perrms (Katello#9153)

(cherry picked from commit 1bba15f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants