mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 00:46:05 +00:00
feat(instances): a VM's access in one strip, its console password kept to its rule
The Access tab hid the console, the root password, the SSH key and the remote viewer behind four sub-tabs. The owner chose a compact layout from three rendered options: the state, a strip with the console and the remote viewer, then two rows for root's password and key, each saying why it waits when it does. Codex reviewed access end to end; these are fixed: - console.vv carries the console password only for users with the passwordless console permission, as the console page passes it; it gave it to every user who may open the console. - The root password field is a labelled password input, not plain text with a 24-character limit. - Without a saved public key the key row is disabled and points to the profile, instead of offering "None". - A paused VM's console opens, as the console view allows. - The remote viewer address and console.vv show only for a VNC or SPICE console that listens beyond the host's loopback; a viewer on the user's computer cannot reach the others, and a serial console gave a pty://…:None address.
This commit is contained in:
parent
efb77dd866
commit
60f12cefa1
6 changed files with 152 additions and 115 deletions
|
|
@ -87,7 +87,7 @@ class PageControls:
|
|||
found = {
|
||||
"console": bool(doc.xpath("//button[@id='console_button']")),
|
||||
"vv file": bool(doc.xpath("//a[@href=$a]", a=reverse("instances:getvvfile", args=[pk]))),
|
||||
"vdi": bool(doc.xpath("//*[@id='vdiconsole']")),
|
||||
"vdi": bool(doc.xpath("//*[@id='vdi_url']")),
|
||||
"power": form("poweron") or bool(doc.xpath("//button[@formaction=$a]", a=reverse("instances:poweroff", args=[pk]))),
|
||||
"root password": form("rootpasswd"),
|
||||
"ssh key": form("add_public_key"),
|
||||
|
|
@ -197,6 +197,14 @@ class PageControlsTestCase(PageControls, TestCase):
|
|||
)
|
||||
self.assertEqual(bool(buttons), enabled)
|
||||
|
||||
def test_a_remote_viewer_only_for_a_console_beyond_the_host_s_loopback(self):
|
||||
admin = get_user_model().objects.create_superuser("vdi_admin", "vdi@example.com", "x")
|
||||
for listen, shown in (("0.0.0.0", True), ("192.0.2.5", True), ("127.0.0.2", False), ("::1", False)):
|
||||
with self.subTest(listen=listen), patch("instances.models.Instance.console_listener_address",
|
||||
new_callable=PropertyMock, return_value=listen):
|
||||
self.controls(admin)
|
||||
self.assertEqual('id="vdi_url"' in self.last_page, shown)
|
||||
|
||||
def test_the_power_tab_offers_the_state_s_actions_and_confirms_a_power_cut(self):
|
||||
admin = get_user_model().objects.create_superuser("power_admin", "pa@example.com", "x")
|
||||
owner = self.user("power_owner", owner={})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue