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

Merge branch 'fix/wave0-authorization-matrix' into wave0-integration

# Conflicts:
#	datasource/views.py
This commit is contained in:
catborise 2026-10-02 22:14:40 +03:00
commit 51db12acfe
12 changed files with 390 additions and 75 deletions

View file

@ -2,8 +2,11 @@ import socket
from accounts.models import UserInstance, UserSSHKey
from computes.models import Compute
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, render
from instances.models import Instance
from instances.utils import can_open_console
from libvirt import libvirtError
from vrtManager.instance import wvmInstance
@ -94,6 +97,10 @@ def get_vdi_url(request, compute_id, vname):
:return:
"""
compute = get_object_or_404(Compute, pk=compute_id)
# The VDI URL points straight at the VM's console: same rule as the console.
instance = Instance.objects.filter(compute=compute, name=vname).first()
if instance is None or not can_open_console(request.user, instance):
raise PermissionDenied
try:
conn = wvmInstance(