File tree Expand file tree Collapse file tree 4 files changed +52
-5
lines changed
Expand file tree Collapse file tree 4 files changed +52
-5
lines changed Original file line number Diff line number Diff line change @@ -62,24 +62,42 @@ def submitWebsiteCreation(self):
6262 try :
6363
6464 try :
65- selectedACL = ACL . objects . get ( name = 'user' )
65+
6666 UserAccountName = self .data ['UserAccountName' ]
6767 UserPassword = self .data ['UserPassword' ]
6868 FullName = self .data ['FullName' ]
6969 token = hashPassword .generateToken (UserAccountName , UserPassword )
7070 password = hashPassword .hash_password (UserPassword )
7171
72+ try :
73+ initWebsitesLimit = int (self .data ['websitesLimit' ])
74+ except :
75+ initWebsitesLimit = 10
76+
77+ try :
78+ acl = self .data ['acl' ]
79+ selectedACL = ACL .objects .get (name = acl )
80+
81+ except :
82+ selectedACL = ACL .objects .get (name = 'user' )
83+
84+ try :
85+ apiAccess = int (self .data ['api' ])
86+ except :
87+ apiAccess = 10
88+
7289 try :
7390 newAdmin = Administrator (firstName = FullName ,
7491 lastName = "" ,
7592 email = self .data ['adminEmail' ],
7693 type = 3 ,
7794 userName = UserAccountName ,
7895 password = password ,
79- initWebsitesLimit = 10 ,
96+ initWebsitesLimit = initWebsitesLimit ,
8097 owner = 1 ,
8198 acl = selectedACL ,
82- token = token
99+ token = token ,
100+ api = apiAccess
83101 )
84102 newAdmin .save ()
85103 except BaseException as msg :
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ class SMTPHosts(models.Model):
2929 owner = models .ForeignKey (Administrator , on_delete = models .CASCADE )
3030 host = models .CharField (max_length = 150 , unique = True )
3131 port = models .CharField (max_length = 10 )
32- userName = models .CharField (max_length = 50 )
33- password = models .CharField (max_length = 50 )
32+ userName = models .CharField (max_length = 200 )
33+ password = models .CharField (max_length = 200 )
3434
3535class EmailTemplate (models .Model ):
3636 owner = models .ForeignKey (Administrator , on_delete = models .CASCADE )
Original file line number Diff line number Diff line change @@ -622,6 +622,16 @@ def applyLoginSystemMigrations():
622622 except :
623623 pass
624624
625+ try :
626+ cursor .execute ("ALTER TABLE emailMarketing_smtphosts MODIFY userName varchar(200)" )
627+ except :
628+ pass
629+
630+ try :
631+ cursor .execute ("ALTER TABLE emailMarketing_smtphosts MODIFY password varchar(200)" )
632+ except :
633+ pass
634+
625635 try :
626636 cursor .execute ("ALTER TABLE websiteFunctions_backups MODIFY fileName varchar(200)" )
627637 except :
Original file line number Diff line number Diff line change @@ -438,12 +438,31 @@ def submitUserDeletion(request):
438438
439439 accountUsername = data ['accountUsername' ]
440440
441+ try :
442+ force = data ['force' ]
443+ except :
444+ force = 0
445+
446+
441447 currentACL = ACLManager .loadedACL (userID )
442448
443449 currentUser = Administrator .objects .get (pk = userID )
444450 userInQuestion = Administrator .objects .get (userName = accountUsername )
445451
452+
446453 if ACLManager .checkUserOwnerShip (currentACL , currentUser , userInQuestion ):
454+
455+
456+ if force :
457+ userACL = ACLManager .loadedACL (userInQuestion .pk )
458+ websitesName = ACLManager .findAllSites (userACL , userInQuestion .pk )
459+
460+ from websiteFunctions .website import WebsiteManager
461+ wm = WebsiteManager ()
462+
463+ for website in websitesName :
464+ wm .submitWebsiteDeletion (userID , {'websiteName' : website })
465+
447466 user = Administrator .objects .get (userName = accountUsername )
448467
449468 childUsers = Administrator .objects .filter (owner = user .pk )
You can’t perform that action at this time.
0 commit comments