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

@ -45,6 +45,13 @@ class UpdateConsoleTestCase(TestCase):
proxy.set_console_listener_addr.assert_called_once_with("0.0.0.0")
proxy.set_console_passwd.assert_not_called()
def test_a_template_s_console_settings_are_not_changed(self):
# its page has no console form: a template is cloned, not run
self.instance.is_template = True
self.instance.save()
proxy, _ = self.post({**VNC, "keymap": "de"})
proxy.set_console_keymap.assert_not_called()
def test_the_password_changes_by_the_action_chosen(self):
for action, password in (("set", " a b c "), ("set", "éééé"), ("none", "")):
with self.subTest(action, password=password):