|
|
|
@ -2,80 +2,117 @@
|
|
|
|
|
# !!! ATTENTION: Backward compatibility has been started from v1.1.13 !!!
|
|
|
|
|
# So you can use config of the orchestrator 1.1.13 in new Orchestrator versions and all will be ok :) (hope it's true)
|
|
|
|
|
import win32security
|
|
|
|
|
|
|
|
|
|
from . import Orchestrator # For user defs
|
|
|
|
|
# v1.2.0 Def for old procesor to new processor
|
|
|
|
|
# Return new activity for the new processor
|
|
|
|
|
def v1_2_0_ProcessorOld2NewActivityDict(inActivityOld):
|
|
|
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
# Technical defs for support old operations in old processor
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
# {
|
|
|
|
|
# "Type":"WindowsLogon",
|
|
|
|
|
# "Domain":"",
|
|
|
|
|
# "User":"",
|
|
|
|
|
# "Password":""
|
|
|
|
|
# # Return "Result": True - user is logged on, False - user is not logged on
|
|
|
|
|
# }
|
|
|
|
|
def WindowLogon(inUserStr, inPasswordStr, inDomainStr=""):
|
|
|
|
|
#################################
|
|
|
|
|
# Windows logon
|
|
|
|
|
#################################
|
|
|
|
|
try:
|
|
|
|
|
hUser = win32security.LogonUser(
|
|
|
|
|
inUserStr,
|
|
|
|
|
inDomainStr,
|
|
|
|
|
inPasswordStr,
|
|
|
|
|
win32security.LOGON32_LOGON_NETWORK,
|
|
|
|
|
win32security.LOGON32_PROVIDER_DEFAULT
|
|
|
|
|
)
|
|
|
|
|
except win32security.error:
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
|
return True
|
|
|
|
|
###################################
|
|
|
|
|
# {
|
|
|
|
|
# "Type": "GlobalDictKeyListValueGet",
|
|
|
|
|
# "KeyList": ["key1","key2",...]
|
|
|
|
|
# },
|
|
|
|
|
def GlobalDictKeyListValueGet(inGSettings, inKeyList=[]):
|
|
|
|
|
###########################################################
|
|
|
|
|
# Обработка команды GlobalDictKeyListValueGet
|
|
|
|
|
###########################################################
|
|
|
|
|
lResult = None
|
|
|
|
|
lDict = inGSettings
|
|
|
|
|
for lItem2 in inKeyList[:-1]:
|
|
|
|
|
# Check if key - value exists
|
|
|
|
|
if lItem2 in lDict:
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
lDict[lItem2] = {}
|
|
|
|
|
lDict = lDict[lItem2]
|
|
|
|
|
# Return value
|
|
|
|
|
lResult = lDict.get(inKeyList[-1], None)
|
|
|
|
|
return lResult
|
|
|
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
|
|
|
|
|
if inActivityOld["Type"] == "WindowsLogon":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": WindowLogon, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"Def": Orchestrator.OSCredentialsVerify, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
"ArgDict":{"inUserStr": inActivityOld["User"],"inPasswordStr":inActivityOld["Password"],"inDomainStr":inActivityOld["Domain"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgGSettings": None, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "GlobalDictKeyListValueGet":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": GlobalDictKeyListValueGet, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"Def": Orchestrator.GSettingsKeyListValueGet, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList":[], # Args list
|
|
|
|
|
"ArgDict":{"inKeyList": inActivityOld["KeyList"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": "inGSettings" # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgGSettings": "inGSettings", # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "CMDStart":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.OSCMD, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inCMDStr": inActivityOld["Command"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": None, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "OrchestratorRestart":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.OrchestratorRestart, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {}, # Args dictionary
|
|
|
|
|
"ArgGSettings": "inGSettings", # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "OrchestratorSessionSave":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.OrchestratorSessionSave,
|
|
|
|
|
# def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {}, # Args dictionary
|
|
|
|
|
"ArgGSettings": "inGSettings", # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "GlobalDictKeyListValueSet":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.GSettingsKeyListValueSet, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inKeyList": inActivityOld["KeyList"], "inValue": inActivityOld["Value"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": "inGSettings", # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "GlobalDictKeyListValueAppend":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.GSettingsKeyListValueAppend, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inKeyList": inActivityOld["KeyList"], "inValue": inActivityOld["Value"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": "inGSettings", # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "GlobalDictKeyListValueOperator+":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.GSettingsKeyListValueOperatorPlus, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inKeyList": inActivityOld["KeyList"], "inValue": inActivityOld["Value"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": None, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "ProcessStart":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.ProcessStart, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inPathStr": inActivityOld["Path"], "inArgList": inActivityOld["ArgList"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": None, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "ProcessStartIfTurnedOff":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.ProcessStart, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inPathStr": inActivityOld["Path"], "inArgList": inActivityOld["ArgList"], "inStopProcessNameWOExeStr": inActivityOld["CheckTaskName"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": None, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "ProcessStop":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.ProcessStop, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inProcessNameWOExeStr": inActivityOld["Name"], "inCloseForceBool": inActivityOld["FlagForce"], "inUserNameStr": inActivityOld["User"]}, # Args dictionary
|
|
|
|
|
"ArgGSettings": None, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
elif inActivityOld["Type"] == "PythonStart":
|
|
|
|
|
lResult = {
|
|
|
|
|
"Def": Orchestrator.PythonStart, # def link or def alias (look gSettings["Processor"]["AliasDefDict"])
|
|
|
|
|
"ArgList": [], # Args list
|
|
|
|
|
"ArgDict": {"inModulePathStr": inActivityOld["ModuleName"], "inDefNameStr": inActivityOld["FunctionName"], "inArgList": inActivityOld["ArgList"],
|
|
|
|
|
"inArgDict": inActivityOld["ArgDict"] }, # Args dictionary
|
|
|
|
|
"ArgGSettings": None, # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
"ArgLogger": "inLogger" # Name of GSettings attribute: str (ArgDict) or index (for ArgList)
|
|
|
|
|
}
|
|
|
|
|
else:
|
|
|
|
|
raise Exception(f"BackwardCompatibility up to v1.2.0, old processor: No type {inActivityOld['Type']} has been found in old processor.")
|
|
|
|
|
return lResult # return the result
|
|
|
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
# # # # # # # # # HERE IS THE MAIN DEF WHICH IS LAUNCHES WHEN START # # # # # # # # #
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
def Update(inGSettings):
|
|
|
|
|
lL = inGSettings["Logger"] # Alias for logger
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|