mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
remove domain from emails table if no email exists
This commit is contained in:
@@ -216,12 +216,13 @@ class MailServerManager(multi.Thread):
|
|||||||
if ACLManager.currentContextPermission(currentACL, 'deleteEmail') == 0:
|
if ACLManager.currentContextPermission(currentACL, 'deleteEmail') == 0:
|
||||||
return ACLManager.loadErrorJson('deleteEmailStatus', 0)
|
return ACLManager.loadErrorJson('deleteEmailStatus', 0)
|
||||||
|
|
||||||
|
|
||||||
data = json.loads(self.request.body)
|
data = json.loads(self.request.body)
|
||||||
email = data['email']
|
email = data['email']
|
||||||
|
|
||||||
eUser = EUsers.objects.get(email=email)
|
eUser = EUsers.objects.get(email=email)
|
||||||
|
|
||||||
|
emailOwnerDomain = eUser.emailOwner
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
if ACLManager.checkOwnership(eUser.emailOwner.domainOwner.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(eUser.emailOwner.domainOwner.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
@@ -229,6 +230,10 @@ class MailServerManager(multi.Thread):
|
|||||||
return ACLManager.loadErrorJson()
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
mailUtilities.deleteEmailAccount(email)
|
mailUtilities.deleteEmailAccount(email)
|
||||||
|
|
||||||
|
if emailOwnerDomain.eusers_set.all().count() == 0:
|
||||||
|
emailOwnerDomain.delete()
|
||||||
|
|
||||||
data_ret = {'status': 1, 'deleteEmailStatus': 1, 'error_message': "None"}
|
data_ret = {'status': 1, 'deleteEmailStatus': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|||||||
@@ -1500,6 +1500,7 @@ class backupUtilities:
|
|||||||
return 0, str(msg)
|
return 0, str(msg)
|
||||||
|
|
||||||
def CloudBackups(self):
|
def CloudBackups(self):
|
||||||
|
|
||||||
import json
|
import json
|
||||||
if os.path.exists(backupUtilities.CloudBackupConfigPath):
|
if os.path.exists(backupUtilities.CloudBackupConfigPath):
|
||||||
result = json.loads(open(backupUtilities.CloudBackupConfigPath, 'r').read())
|
result = json.loads(open(backupUtilities.CloudBackupConfigPath, 'r').read())
|
||||||
|
|||||||
Reference in New Issue
Block a user