From 69791457b8c3542fd1556d3444d6a357c4c033a6 Mon Sep 17 00:00:00 2001 From: sepehr Date: Tue, 13 Aug 2024 18:02:49 +0330 Subject: [PATCH] prevent deleting main admin --- py/api/api_account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/py/api/api_account.py b/py/api/api_account.py index db647b3..f4a62a8 100644 --- a/py/api/api_account.py +++ b/py/api/api_account.py @@ -121,7 +121,9 @@ def user_delete(): u = db.get_user(uid) except: u=False - + if str(u.id) == "37cc36e0-afec-4545-9219-94655805868b" or str(u.username)=='system': + resp={"status":"failed","err":"Cannot delete admin user"} + return buildResponse(resp, 200) if not u: msg = "User not found: {}".format(uid) resp={"status":"failed","err":msg}