Bug 1722799

Summary: Unclear / incomplete error message while trying to promote a content view with a user that has insufficient permissions
Product: Red Hat Satellite Reporter: Michael Schwabe <mschwabe>
Component: Content ViewsAssignee: Ian Ballou <iballou>
Status: CLOSED ERRATA QA Contact: Danny Synk <dsynk>
Severity: medium Docs Contact:
Priority: high    
Version: 6.5.0CC: bkearney, fperalta, ivo.schindler, jjeffers, pdwyer, pjasbuti, satellite6-bugs, sokeeffe, swachira, zhunting
Target Milestone: 6.9.0Keywords: EasyFix, FastFix, Reproducer, Triaged, UserExperience
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.18.1.7-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1943272 (view as bug list) Environment:
Last Closed: 2021-04-21 13:11:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michael Schwabe 2019-06-21 10:52:26 UTC
Description of problem:
A user called "updater" with assigned Role called "updater" has the following permissions:
Lifecycle Environments => edit_lifecycle_environments
"content views" => view_content_views, edit_content_views, promote_or_remove_content_views

Using this user to promote a content-view results in the following error:
Could not promote the content view:
  Access denied
  Missing one of the required permissions: promote_or_remove_content_views

As you can see the error message states "Missing one of the..." which is plural, but only lists ONE missing permission.
In addition, this permission is already given to the user in question. What's really missing is the following permission:
Lifecycle Environments => promote_or_remove_content_views_to_environment

But the error message does not state this. This confused my customer and he opened a case. There's already a KCS for this but I think extending
the error message to list all required permissions may be the better approach.

Version-Release number of selected component (if applicable):
Satellite 6.4.3 (customers Satellite on which the issue was reported)
Satellite 6.5.0 (my test Satellite used to reproduce the issue)

How reproducible:


Steps to Reproduce:
- create user "updater"
- grant viewer role
- create new role "updater"
- apply filters to role "updater":
-- "Lifecycle Environments" => edit_lifecycle_environments
-- "content views" => view_content_views, edit_content_views, promote_or_remove_content_views

Try to promote a content view with that user to get the error:

[root@satellite ~]# hammer -u updater content-view version promote --content-view-id <ID> --to-lifecycle-environment-id <ID> --id <ID> --organization-id <ID>
[Foreman] Password for updater: 
Could not promote the content view:
  Access denied
  Missing one of the required permissions: promote_or_remove_content_views

Actual results:
Could not promote the content view:
  Access denied
  Missing one of the required permissions: promote_or_remove_content_views

Expected results:
Could not promote the content view:
  Access denied
  Missing one of the required permissions: promote_or_remove_content_views, view_content_views, edit_content_views, promote_or_remove_content_views_to_environment

Additional info:

Comment 6 ivo.schindler 2020-02-12 15:37:48 UTC
this bug still exists in satellite 6.5.3...

Comment 15 Ian Ballou 2021-02-08 18:35:09 UTC
Created redmine issue https://projects.theforeman.org/issues/31836 from this bug

Comment 16 Bryan Kearney 2021-02-10 00:04:08 UTC
Upstream bug assigned to iballou

Comment 17 Bryan Kearney 2021-02-10 00:04:10 UTC
Upstream bug assigned to iballou

Comment 19 Bryan Kearney 2021-02-17 20:04:16 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/31836 has been resolved.

Comment 21 Danny Synk 2021-03-04 20:51:11 UTC
Steps to Test:

- Deploy Satellite 6.9, snap 16.
- Sync repositories, add them to a content view, and publish the content view.
- Create a Lifecycle Environment Path with a "dev" lifecycle environment.
- Create the "updater" user.
- Add the "Viewer" role to the "updater" user.
- Create the "updater" role.
- Add the following filters to the "updater" role:
  - "Lifecycle Environments" > edit_lifecycle_environments
  - "Content Views" > view_content_views, edit_content_views, promote_or_remove_content_views
- Attempt to promote the content view to the "dev" environment as the "updater" user:

~~~
[root@dhcp-3-161 ~]# hammer -u updater content-view version promote --content-view-id 2 --to-lifecycle-environment-id 2 --id 2 --organization-id 1
[Foreman] Password for updater: 
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
~~~

Expected Results:
- The missing permission, "promote_or_remove_content_views_to_environments" is listed in the error message.

Actual Results:
- The missing permission, "promote_or_remove_content_views_to_environments" is listed in the error message.

The problem description of this BZ suggests listing all required permissions in the error message; however, the current behavior lists all required permissions from only the relevant Resource Type (in this case, Lifecycle Environments). This narrower scope strikes me as more useful to a user attempting to troubleshoot this issue than listing all required permissions across all Resource Types.

Verified in Satellite 6.9, snap 16 (tfm-rubygem-katello-3.18.1.11-1.el7sat.noarch).

Comment 24 errata-xmlrpc 2021-04-21 13:11:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.9 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:1313