Skip to content

Hide volumes tab in instance page when user does not have permission to list volumes#8713

Merged
DaanHoogland merged 1 commit intoapache:mainfrom
scclouds:hide-volumes-tab-when-user-does-not-have-permission
Apr 25, 2024
Merged

Hide volumes tab in instance page when user does not have permission to list volumes#8713
DaanHoogland merged 1 commit intoapache:mainfrom
scclouds:hide-volumes-tab-when-user-does-not-have-permission

Conversation

@winterhazel
Copy link
Copy Markdown
Member

Description

In any instance's page, the volumes tab always gets shown, even if the account does not have permission to list the instance's volumes.

This PR adds a check in the UI in order to hide the volumes tab if the current account does not have permission to use the listVolumes API.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

Before, a user without permission could access the volumes tab, but the volumes would not get listed. With these changes, the volumes tab does not get shown.

Screenshot from 2024-02-27 16-07-56

How Has This Been Tested?

  1. I created a role that had access to listVolumes;
  2. I created an account using the role;
  3. I created a VM using the account;
  4. In the created account, I accessed the VM's page and verified that the volumes tab was shown;
  5. I removed the access to listVolumes from the role created in step 1;
  6. In the created account, I accessed the VM's page again and verified that the volumes tab was not shown.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 30.98%. Comparing base (c8a4575) to head (2faf3aa).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8713   +/-   ##
=========================================
  Coverage     30.98%   30.98%           
- Complexity    33497    33505    +8     
=========================================
  Files          5355     5355           
  Lines        375780   375780           
  Branches      54913    54913           
=========================================
+ Hits         116429   116445   +16     
+ Misses       243932   243905   -27     
- Partials      15419    15430   +11     
Flag Coverage Δ
simulator-marvin-tests 24.85% <ø> (+<0.01%) ⬆️
uitests 4.36% <ø> (ø)
unit-tests 16.58% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan ui

@blueorangutan
Copy link
Copy Markdown

@DaanHoogland a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/8713 (QA-JID-291)

@DaanHoogland
Copy link
Copy Markdown
Contributor

tested works in qa, but note that also the whole storage tab in the main menu has disappeared:
image

was this intended @winterhazel ? (no snapshots/backups)

Comment thread ui/src/views/compute/InstanceTab.vue
@winterhazel
Copy link
Copy Markdown
Member Author

tested works in qa, but note that also the whole storage tab in the main menu has disappeared: image

was this intended @winterhazel ? (no snapshots/backups)

@DaanHoogland the changes in this PR do not affect the storage tab in the main menu.

There are two APIs for listing volumes: listVolumesMetrics (used in the volumes listing page) and listVolumes (used in the instance's page, where this PR is adding a check). I suppose that the storage tab disappeared for you because the access to listVolumesMetrics has been denied (this is the current behavior, which has not been affected by this PR).

@DaanHoogland
Copy link
Copy Markdown
Contributor

tested works in qa, but note that also the whole storage tab in the main menu has disappeared: ![image](https://
was this intended @winterhazel ? (no snapshots/backups)

@DaanHoogland the changes in this PR do not affect the storage tab in the main menu.

There are two APIs for listing volumes: listVolumesMetrics (used in the volumes listing page) and listVolumes (used in the instance's page, where this PR is adding a check). I suppose that the storage tab disappeared for you because the access to listVolumesMetrics has been denied (this is the current behavior, which has not been affected by this PR).

Ok, this then is another bug, no storage page when rights to listBackups and listSnapshots do exist :(

@BryanMLima
Copy link
Copy Markdown
Contributor

Manually tested this, LGTM.
image


tested works in qa, but note that also the whole storage tab in the main menu has disappeared: ![image](https://
was this intended @winterhazel ? (no snapshots/backups)

@DaanHoogland the changes in this PR do not affect the storage tab in the main menu.
There are two APIs for listing volumes: listVolumesMetrics (used in the volumes listing page) and listVolumes (used in the instance's page, where this PR is adding a check). I suppose that the storage tab disappeared for you because the access to listVolumesMetrics has been denied (this is the current behavior, which has not been affected by this PR).

Ok, this then is another bug, no storage page when rights to listBackups and listSnapshots do exist :(

Regarding this situation I will create an issue, may even create a PR for this, as this should be an easy fix.

Copy link
Copy Markdown
Contributor

@lucas-a-martins lucas-a-martins left a comment

Choose a reason for hiding this comment

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

lgtm

@DaanHoogland
Copy link
Copy Markdown
Contributor

@sureshanaparti are your concerns met?

@winterhazel
Copy link
Copy Markdown
Member Author

@sureshanaparti are your concerns met?

Ping @sureshanaparti

Copy link
Copy Markdown
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

Code LGTM

Copy link
Copy Markdown
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

code lgtm

@DaanHoogland DaanHoogland merged commit 8923110 into apache:main Apr 25, 2024
@yadvr yadvr added this to the 4.20.0.0 milestone Apr 25, 2024
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants