-
-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a080be2
commit b51ef9d
Showing
5 changed files
with
159 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/local/CyberCP/bin/python | ||
import os, sys | ||
|
||
sys.path.append('/usr/local/CyberCP') | ||
import django | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") | ||
django.setup() | ||
import threading as multi | ||
from plogical.acl import ACLManager | ||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging | ||
|
||
|
||
|
||
class UserManager(multi.Thread): | ||
|
||
def __init__(self, function, extraArgs): | ||
multi.Thread.__init__(self) | ||
self.function = function | ||
self.extraArgs = extraArgs | ||
|
||
|
||
def run(self): | ||
try: | ||
if self.function == 'controlUserState': | ||
self.controlUserState() | ||
except: | ||
pass | ||
|
||
def controlUserState(self): | ||
try: | ||
websites = ACLManager.findAllSites(self.extraArgs['currentACL'],self.extraArgs['user']) | ||
from websiteFunctions.website import WebsiteManager | ||
|
||
wm = WebsiteManager() | ||
|
||
if self.extraArgs['state'] == 'SUSPEND': | ||
for items in websites: | ||
data = {'websiteName': items, 'state': 'Suspend'} | ||
wm.submitWebsiteStatus(self.extraArgs['user'].pk, data) | ||
else: | ||
for items in websites: | ||
data = {'websiteName': items, 'state': 'UN-Suspend'} | ||
wm.submitWebsiteStatus(self.extraArgs['user'].pk, data) | ||
|
||
|
||
except BaseException as msg: | ||
logging.writeToFile(str(msg) + '[Error:UserManager:32]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters