Repository navigation
Allow project admin to update template/ISO permissions in projects - #14510
DaanHoogland wants to merge 1 commit into
Conversation
…oject-owned templates Project-owned templates can only have their permissions (ispublic, isextractable, launch permissions) changed by a CloudStack admin or by an account whose id equals the template's owner account id. For a project-owned template the owner is the project's pseudo-account, which no human account id can ever equal, so every project member - including the Project Admin who originally registered the template - was rejected by updateTemplateOrIsoPermissions(). Fix: compute whether the caller is the Project Admin of the owning project via the existing ProjectManager.canModifyProjectAccount() check (the same check DomainChecker already uses for AccessType.ModifyProject) and let that satisfy both ownership checks in TemplateManagerImpl.updateTemplateOrIsoPermissions(), alongside the existing owner/admin checks. Added TemplateManagerImplTest#testUpdateTemplatePermissionsAllowsProjectAdminToActAsOwner, which fails with the old code (InvalidParameterValueException) and passes with the fix. Fixes CS-3498 / apache#14174
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14510 +/- ##
============================================
+ Coverage 16.41% 16.43% +0.01%
- Complexity 13657 13677 +20
============================================
Files 5669 5669
Lines 501628 501632 +4
Branches 60942 60940 -2
============================================
+ Hits 82336 82437 +101
+ Misses 410064 409937 -127
- Partials 9228 9258 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19800 |
|
@blueorangutan test keepEnv |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-17313) |
Project-owned templates can only have their permissions (ispublic, isextractable, launch permissions) changed by a CloudStack admin or by an account whose id equals the template's owner account id. For a project-owned template the owner is the project's pseudo-account, which no human account id can ever equal, so every project member - including the Project Admin who originally registered the template - was rejected by updateTemplateOrIsoPermissions().
Fix: compute whether the caller is the Project Admin of the owning project via the existing ProjectManager.canModifyProjectAccount() check (the same check DomainChecker already uses for AccessType.ModifyProject) and let that satisfy both ownership checks in
TemplateManagerImpl.updateTemplateOrIsoPermissions(), alongside the existing owner/admin checks.
Added TemplateManagerImplTest#testUpdateTemplatePermissionsAllowsProjectAdminToActAsOwner, which fails with the old code (InvalidParameterValueException) and passes with the fix.
Fixes #14174
Description
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?