Bug 1635305

Summary: Subscriptions details page does not handle Org switch correctly.
Product: Red Hat Satellite Reporter: Perry Gagne <pgagne>
Component: Subscription ManagementAssignee: Jeremy Lenz <jlenz>
Status: CLOSED ERRATA QA Contact: Perry Gagne <pgagne>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: egolov, jlenz, walden
Target Milestone: 6.6.0Keywords: Regression, Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.12.0.15-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 19:51:08 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 Perry Gagne 2018-10-02 14:55:49 UTC
Description of problem:
I found this while verifying bz 1609817, It seems to be similar to that bug but happens when you select a specific subscription to view details, then try to switch the org.

Version-Release number of selected component (if applicable): 6.4 snap 25


How reproducible: Always

Steps to Reproduce:

--Flow 1--
1. Start with default org. 
2. On subscriptions page select one of the subscription 
3. Using the mast head org switcher, change to another org with different subscriptions.

Actual Results:
The details for the subscription still show. Clicking the enabled products tab shows it as empty. 

See Screen recording here:
https://drive.google.com/open?id=1fdDT-LsEwNRioPON6eHaHICpz8kiFYOl

Expected results
User is directed to the main subscriptions page for the selected org. 

--Flow 2--
1. Start with default org 
2. On subscriptions page select one of the subscriptions
3. Using mast head org switcher, select  "Any Organization"

Actual Results:

2 errors are displayed with message "Organization with id undefined not found"

See screen recording here:
https://drive.google.com/open?id=1baKSgSWnx6w-vZWQrU-or9v8ZCCyt3i5

Expected Results:
User is directed to org selection page.


Additional info:
I added the screen recordings to this folder, if you find additional examples please add upload them to this folder. 
https://drive.google.com/drive/folders/1YnL3EJrZbVSePKTJ7ciBMojjxfpvWA9Z?usp=sharing

Comment 4 Walden Raines 2018-10-03 14:03:14 UTC
Created redmine issue https://projects.theforeman.org/issues/25113 from this bug

Comment 5 Satellite Program 2018-10-31 18:02:08 UTC
Upstream bug assigned to afeferku

Comment 6 Walden Raines 2019-03-14 18:54:42 UTC
The PR [1] is based on some subscription page refactoring that was done upstream.  It will likely be much easier and safer to apply this to a future release such as 6.6.  Marking as untriaged to get another look at triaging this for a future release since there is a workaround for now (reload the page).

[1] https://github.com/Katello/katello/pull/8022/

Comment 8 Bryan Kearney 2019-03-28 18:01:49 UTC
Upstream bug assigned to jomitsch

Comment 9 Bryan Kearney 2019-03-28 18:01:51 UTC
Upstream bug assigned to jomitsch

Comment 11 Bryan Kearney 2019-06-24 22:01:43 UTC
Upstream bug assigned to jomitsch

Comment 12 Bryan Kearney 2019-06-24 22:01:45 UTC
Upstream bug assigned to jomitsch

Comment 13 Jeremy Lenz 2019-07-25 20:29:01 UTC
The attached PR addresses Flow 2 (the 'id undefined' errors):

https://github.com/Katello/katello/pull/8227

Flow 1 happens because the page doesn't check for permission to view the subscription details, because we don't have easy access to that permission data.
Per the discussion on the PR, Flow 1 will be addressed as part of a more comprehensive look at how Katello deals with permissions.

Comment 14 Walden Raines 2019-07-26 15:29:26 UTC
(In reply to Jeremy from comment #13)
> The attached PR addresses Flow 2 (the 'id undefined' errors):
> 
> https://github.com/Katello/katello/pull/8227
> 
> Flow 1 happens because the page doesn't check for permission to view the
> subscription details, because we don't have easy access to that permission
> data.
> Per the discussion on the PR, Flow 1 will be addressed as part of a more
> comprehensive look at how Katello deals with permissions.

Flow #1 will be fixed by https://projects.theforeman.org/issues/27450 which will prevent users from accessing pages they don't have permission to view.

Organization switching in general will also be helped by https://projects.theforeman.org/issues/27451, which suggests that we rewrite the organization switcher in foreman in react so that it stores the organization in the foreman redux store. Once we do that we can fix katello to use that store and we'll only have one single source of truth for what organization is selected.  

Both of these efforts are too large for 6.6 so look for them (hopefully) in 6.7

TL;DR: only flow 2 is fixed as part of this BZ.

Comment 15 Bryan Kearney 2019-07-26 16:01:44 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25113 has been resolved.

Comment 18 Perry Gagne 2019-08-26 19:03:35 UTC
Verified fix in 6.6 snap 17. 

Verified that Flow 2 described above now redirects the user to the "Select an organization" page as expected. 

As for flow 1 I filed bz 1745736.

Comment 19 Jeremy Lenz 2019-09-04 16:59:42 UTC
This should be resolved. Please let me know if any additional info is needed.

Comment 20 Bryan Kearney 2019-10-22 19:51:08 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, 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-2019:3172