1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

Merge branch 'fix/wave0-staff-console-password' into wave0-integration

This commit is contained in:
catborise 2026-10-02 22:14:40 +03:00
commit 34851b8dc2
4 changed files with 118 additions and 15 deletions

View file

@ -264,3 +264,18 @@ def get_clone_disk_name(disk, prefix, clone_name=""):
else:
image = f"{disk['image']}-clone"
return image
def can_manage_console(user, instance):
"""
Who may see and change a VM's console settings, including its VNC
password: an active superuser, or an active owner with both is_change and
is_vnc. is_staff and the global view_instances permission do not count.
"""
if not user.is_active:
return False
if user.is_superuser:
return True
return UserInstance.objects.filter(
instance=instance, user=user, is_change=True, is_vnc=True
).exists()