1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 03:36:48 +00:00

fix(instances): a template is not power-cycled on, and deleted only by superusers and staff owners

Power cycle force-stopped and started a template, which power on refuses.
A non-staff owner with is_delete could delete a template that the
template rule otherwise leaves to superusers and staff owners;
get_instance(perm_type="delete") now refuses it, and the page offers
Destroy by the same rule.
This commit is contained in:
catborise 2026-10-07 23:57:10 +03:00
parent e481b24240
commit 70bed79c60
8 changed files with 98 additions and 16 deletions

View file

@ -128,12 +128,13 @@ ROLE_EXPECTATIONS = {
}
# A template VM: only superusers and staff owners with is_change change it;
# other owners with is_change keep view, power (poweron is a no-op on a
# template) and console. Cloning has its own rule, see the clone test.
# A template VM: only superusers and staff owners change or delete it; other
# owners keep view, power (poweron and powercycle are no-ops on a template)
# and console. Cloning has its own rule, see the clone test.
TEMPLATE_ROLE_EXPECTATIONS = {
**ROLE_EXPECTATIONS,
"owner_is_change": (False, False, {"is_change": True}, VIEW_VM | POWER_AND_CONSOLE),
"owner_is_delete": (False, False, {"is_delete": True}, VIEW_VM | POWER_AND_CONSOLE),
}