Bug 2109633

Summary: [WebUi] Loading cluster visually stuck when user is without read permission for the cluster
Product: Red Hat Enterprise Linux 9 Reporter: Ivan Devat <idevat>
Component: pcsAssignee: Ivan Devat <idevat>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: cluster-maint, idevat, mlisik, mmazoure, mpospisi, omular, svalasti, tojeline
Target Milestone: rcKeywords: Triaged
Target Release: 9.2Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.11.4-1.el9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:18:23 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 Ivan Devat 2022-07-21 16:32:46 UTC
Steps to Reproduce:

Let's have a user "user1" with group "haclient".
Let's have a cluster with only the standard permission for group "haclient".

* Login into web ui as "user1".
* Go to section "Permissions" in the cluster detail.
* Remove permissions but "Grant" for the group "haclient".
* Wait for data refresh or refresh page manually.


Actual results:

There is a notification:
> Task: sync status of cluster "abc" failed: Permission denied. Details in the browser console.

But spinner on the page still says:
> Loading cluster data

Moreover, the user "user1" is not able edit permissions even though "Grant" permission is there.

Expected results:
* Instead of spinner, there is message that user has no permission for displaying cluster.
* The user is able to edit permissions.

Comment 1 Ivan Devat 2022-11-19 16:29:41 UTC
https://github.com/ClusterLabs/pcs-web-ui/commit/97d656a8bf5421c476ffec8bb2995a9baa73b978

How to test:

* Let's have a user "user1" with group "haclient".
* Let's have a cluster with only the standard permission for group "haclient".


> Remove permission

* Login into web ui as "user1".
* Go to section "Permissions" in the cluster detail.
* Edit permissions for the group "haclient"
  * Remove all permissions except "Grant".
  * Click "Update permission"
* Close the dialog


> Check information that reading cluster is forbidden

* Switch to any other cluster tab
  * There should be only message that you have no permission to read the cluster
* Switch to dashboard (click on breadcrumbs)
  * The information that it is forbidden to read should appear


> Add read permission

* Go to cluster detail 
* Go to section "Permissions" in the cluster detail.
* Edit permissions for the group "haclient"
  * Add permission "read"
  * Click "Update permission"


> Check that it is possible to read cluster

* Switch to any other cluster tab and check cluster information is visible
  * If you see spinner wait until cluster state arrive
* Switch to dashboard and check cluster information is visible

Comment 2 Michal Pospisil 2022-11-24 12:18:52 UTC
DevTestResults:
No information about the cluster is visible for users without read permissions.

Comment 7 svalasti 2023-01-30 15:37:26 UTC
[root@virt-594 ~]# rpm -q pcs
pcs-0.11.4-4.el9.x86_64


> Only a basic check of this implemented feature has been performed. Our priority at the moment is to automate the tasks that are possible by using the GUI.

Testing steps:

## ACL:
    * Let's have a user "user1" with group "haclient".
    * Let's have a cluster with only the standard permission for group "haclient".

> OK. After successful creation of "user1" and after adding it to the "haclient" group it is possible to successfully log into the GUI.


## Remove permission:
    * Login into web ui as "user1".
    * Go to section "Permissions" in the cluster detail.
    * Edit permissions for the group "haclient"
        * Remove all permissions except "Grant".
        * Click "Update permission"
    * Close the dialog

> OK. After the selection of "edit" permission(s) on "Permissions" tab for "haclient" group, a modal window is opened. After removing all permissions except the "grant" permission, the user is informed by an information message which is displayed in the modal window, about the fact that "Permissions updated successfully". After a successful update of permission for group "haclient", a warning message about missing read permission is displayed to the user (on all other cluster tabs). In this case, "user1" from group "haclient" is not allowed to see the content of other cluster tabs (no spinner).


## Add read permission:
    * Go to cluster detail 
    * Go to section "Permissions" in the cluster detail.
    * Edit permissions for the group "haclient"
        * Add permission "read"
        * Click "Update permission"

> OK. It is possible to read all cluster tabs in GUI after adding "read" permission back to the group "haclient".


> Marking as VERIFIED SanityOnly for pcs-0.11.4-4.el9

Comment 9 errata-xmlrpc 2023-05-09 07:18:23 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 (pcs bug fix and enhancement update), 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/RHBA-2023:2151