apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
1.83k stars 1.07k forks source link

[UI] Add option to select owner of volume when creating it #9265

Closed gpordeus closed 7 hours ago

gpordeus commented 1 week ago

Description

This PR allows selecting a target account (or project) during volume creation through the UI, using #8919's OwnershipSelection.

Types of changes

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

Screenshots (if appropriate):

image

How Has This Been Tested?

Environment with one domain (dom), besides root, and a domain admin and an user accounts in both root and dom, as well as the Root Admin. Every account created one project each.

Table lists all options shown in UI, when logged as each of the accounts: (User accounts did not show the selection fields Owner type, Domain and Account/Project. Neither did any of the projects.)

Logged in as Listed domains Listed accounts Listed projects
ROOT Admin (admin) - ROOT
- ROOT/dom
- admin, dadm, usr
- dom-adm, dom-usr
- admin-proj, dadm-proj, usr-proj
- dom-adm-proj, dom-usr-proj
ROOT Domain Admin (dadm) - ROOT
- ROOT/dom
- admin, dadm, usr
- dom-adm, dom-usr
- admin-proj, dadm-proj, usr-proj
- *
ROOT User (usr) --- --- ---
ROOT/dom Domain Admin (dom-adm) - ROOT/dom - dom-adm, dom-usr - dom-adm-proj, dom-usr-proj
ROOT/dom User (dom-usr) --- --- ---

Testing this, I found a bug on listProjects. A domain admin can't list a subdomain's projects, with isrecursive or not.

I'm still working on the best way to go about it and will open a PR to fix it, but it's not ready yet.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 4.18%. Comparing base (cb48202) to head (726ba87). Report is 37 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #9265 +/- ## ======================================== - Coverage 4.19% 4.18% -0.01% ======================================== Files 369 369 Lines 30233 30297 +64 Branches 5343 5365 +22 ======================================== Hits 1269 1269 - Misses 28820 28884 +64 Partials 144 144 ``` | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/9265/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/9265/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.18% <ø> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

DaanHoogland commented 1 week ago

@blueorangutan ui

blueorangutan commented 1 week ago

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

blueorangutan commented 1 week ago

UI build: :heavy_check_mark: Live QA URL: https://qa.cloudstack.cloud/simulator/pr/9265 (QA-JID-383)

DaanHoogland commented 1 week ago

@gpordeus two concerns

  1. image somehow offerings are not found.
  2. is this meant for (domain) admins or for every user?
gpordeus commented 1 week ago

Hi, @DaanHoogland , thanks for checking this out.

somehow offerings are not found.

The offerings not found is a regression that happened on 4.19 (version of QA environment), where calling listDiskOfferings with domainid and account name short circuits in searching for domain-only disk offerings. This was fixed (I believe on #8321, so it will probably be fine on 4.19.1) and the offerings show up on the form when using 4.20, which is the target.

is this meant for (domain) admins or for every user?

Just admins, it uses the same verification as #8919.