Repository navigation
Conversation
Fixes: apache#14070 Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
|
@1fanwang could you please request a review for this PR so we can potentially review,test and get this into 24.0? |
@RosiKyu I tried, but GitHub only lets committers request reviewers on apache/cloudstack, so the request fails from my account. Could you add yourself or whoever owns the UI? The PR is ready, and the test and its HTTP fixture are in the diff. |
| }, | ||
| getVolumes () { | ||
| getAPI('listVolumes', { listall: true, listsystemvms: true, virtualmachineid: this.vm.id }).then(json => { | ||
| getAPI('listVolumes', { listall: true, listsystemvms: true, projectid: '-1', virtualmachineid: this.vm.id }).then(json => { |
There was a problem hiding this comment.
can we send the vm's own projectid only when it has one? with -1 a domain admin looking at another user's vm in their domain gets an empty tab
There was a problem hiding this comment.
that covers it, the tab now sends the vm's own project in 7e0ef8e
projectid=-1 reaches only the caller's own account and the projects they belong to, so a domain admin saw an empty Volumes tab for other users' instances and for projects they had not joined. Send the project only for an instance that belongs to one. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Description
Opening a project instance from Default view shows an empty Volumes tab even though its disks exist, because the volume list skips project resources unless the request names a project. The tab now sends the instance's own project, so the disks appear without switching projects, for root admins and domain admins alike. An instance that belongs to no project sends none, so its request is unchanged.
The tab does not ask the server for every project at once. That request reaches only the caller's own account and the projects they belong to, so a domain admin would see an empty tab for other users' instances and for projects they have not joined.
Fixes: #14070
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
The reproduction checks the rendered table rows; the layout is unchanged.
How Has This Been Tested?
A unit test in this diff covers the same cases against a local HTTP fixture that follows the server's listing rules. The run below uses a real server.
E2E
The real Volumes tab ran against CloudStack 4.22.1.0 with MySQL 8.0.46 and the Simulator hypervisor, logged in as each role. Marvin deployed the standard simulator datacenter. The fixtures come from API calls with no database edits: a domain with a domain admin and a user, a project the domain admin belongs to, a project owned by the user, an instance in each, an account-owned instance, and the secondary storage system VM. The test adds only the login session a browser would hold and selects the project view through browser local storage. The request, the response and the component are real.
Save the three reproducer files below (create_fixtures.py, probe_server.py and volumes.spec.js) in one directory and run the commands from it. The UI commands use a CloudStack checkout with the ui dependencies installed. Start the simulator and create the fixtures:
What the server returns for each caller, instance and projectid value. A domain admin gets nothing for another user's instance, or for a project they have not joined, when the request asks for all projects (projectid=-1), and gets the volumes when it names the instance's own project:
The component against the same server. For the base run the base file is put in place first. The logged projectid is undefined when the request carried none. Before, at 9030443:
After, at 7e0ef8e:
Reproducer source: create_fixtures.py
Reproducer source: probe_server.py
Reproducer source: volumes.spec.js
How did you try to break this feature and the system with this change?
I opened the tab as a root admin and as a domain admin, for an instance owned by another user, for a project the domain admin belongs to, for a project they do not belong to, and for the secondary storage system VM, with and without another project selected in the project view.