1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-24 15:58:08 +00:00

Prevent locked drawings to be deleted. Fixes https://github.com/GNS3/gns3-gui/issues/2948

This commit is contained in:
grossmj 2020-03-16 16:30:08 +10:30
parent 868c39acfe
commit 615cffd9ac
2 changed files with 2 additions and 1 deletions

View File

@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import hashlib import hashlib
import asyncio
import base64 import base64
import uuid import uuid
import re import re

View File

@ -684,6 +684,8 @@ class Project:
@open_required @open_required
async def delete_drawing(self, drawing_id): async def delete_drawing(self, drawing_id):
drawing = self.get_drawing(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] del self._drawings[drawing.id]
self.dump() self.dump()
self.emit_notification("drawing.deleted", drawing.__json__()) self.emit_notification("drawing.deleted", drawing.__json__())