From 615cffd9ac6b2a84793acdfcecf21fb45b5b0e68 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 16 Mar 2020 16:30:08 +1030 Subject: [PATCH] Prevent locked drawings to be deleted. Fixes https://github.com/GNS3/gns3-gui/issues/2948 --- gns3server/controller/drawing.py | 1 - gns3server/controller/project.py | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/drawing.py b/gns3server/controller/drawing.py index 4ef324b4..de929b2f 100644 --- a/gns3server/controller/drawing.py +++ b/gns3server/controller/drawing.py @@ -16,7 +16,6 @@ # along with this program. If not, see . import hashlib -import asyncio import base64 import uuid import re diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index 04d4a798..29ab0842 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -684,6 +684,8 @@ class Project: @open_required async def delete_drawing(self, drawing_id): drawing = self.get_drawing(drawing_id) + if drawing.locked: + raise aiohttp.web.HTTPConflict(text="Drawing ID {} cannot be deleted because it is locked".format(drawing_id)) del self._drawings[drawing.id] self.dump() self.emit_notification("drawing.deleted", drawing.__json__())