1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00

fix(instances): a template's console settings cannot be changed by a POST

A template's page has no console settings form (it is cloned, not run),
but update_console still took a direct POST from a staff owner with
is_change and is_vnc, or from a superuser. can_manage_console now refuses
every template, so the page and the view use one rule.
This commit is contained in:
catborise 2026-11-09 13:53:51 +03:00
parent 7edfdca2da
commit dc912bd346
4 changed files with 18 additions and 7 deletions

View file

@ -136,9 +136,16 @@ ROLE_EXPECTATIONS = {
# 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.
# and console. No one changes its console settings: a template is cloned, not
# run. Cloning has its own rule, see the clone test.
TEMPLATE_ROLE_EXPECTATIONS = {
**ROLE_EXPECTATIONS,
"staff_owner_is_change_is_vnc": (
True,
False,
{"is_change": True, "is_vnc": True},
VIEW_VM | POWER_AND_CONSOLE | CHANGE_VM | TEMPLATE_FLAG,
),
"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),
}