1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Added permission can snapshot instances

This commit is contained in:
Info-IIG 2022-06-16 14:55:08 +02:00
parent e26a114c44
commit 052610dd21
3 changed files with 5 additions and 4 deletions

View file

@ -813,7 +813,7 @@ def snapshot(request, pk):
instance = get_instance(request.user, pk)
allow_admin_or_not_template = request.user.is_superuser or request.user.is_staff or not instance.is_template
if allow_admin_or_not_template:
if allow_admin_or_not_template and request.user.has_perm("instances.snapshot_instances"):
name = request.POST.get("name", "")
instance.proxy.create_snapshot(name)
msg = _("Create snapshot: %(snap)s") % {"snap": name}
@ -824,7 +824,7 @@ def snapshot(request, pk):
def delete_snapshot(request, pk):
instance = get_instance(request.user, pk)
allow_admin_or_not_template = request.user.is_superuser or request.user.is_staff or not instance.is_template
if allow_admin_or_not_template:
if allow_admin_or_not_template and request.user.has_perm("instances.snapshot_instances"):
snap_name = request.POST.get("name", "")
instance.proxy.snapshot_delete(snap_name)
msg = _("Delete snapshot: %(snap)s") % {"snap": snap_name}
@ -835,7 +835,7 @@ def delete_snapshot(request, pk):
def revert_snapshot(request, pk):
instance = get_instance(request.user, pk)
allow_admin_or_not_template = request.user.is_superuser or request.user.is_staff or not instance.is_template
if allow_admin_or_not_template:
if allow_admin_or_not_template and request.user.has_perm("instances.snapshot_instances"):
snap_name = request.POST.get("name", "")
instance.proxy.snapshot_revert(snap_name)
msg = _("Successful revert snapshot: ")