mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 00:08:11 +00:00
Prevent locked drawings to be deleted. Fixes https://github.com/GNS3/gns3-gui/issues/2948
This commit is contained in:
parent
868c39acfe
commit
615cffd9ac
@ -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
|
||||||
|
@ -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__())
|
||||||
|
Loading…
Reference in New Issue
Block a user