1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 16:36:06 +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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-09 13:53:51 +03:00
parent d34b1eb2bf
commit 0cee65805d
4 changed files with 18 additions and 7 deletions

View file

@ -288,8 +288,7 @@ def _instance_page(request, pk, instance, compute):
publickeys = UserSSHKey.objects.filter(user_id=request.user.id)
# The console form renders the VNC password, so only users who may manage
# console settings get the form (and the password) at all.
# a template is cloned, not run: no console settings or host devices on its page
can_manage_console = utils.can_manage_console(request.user, instance) and not instance.is_template
can_manage_console = utils.can_manage_console(request.user, instance)
console_form = None
if can_manage_console:
console_form = ConsoleForm(instance=instance, is_superuser=request.user.is_superuser)