From 2e62fe58e0ce75d49d6d6b2578c1e44ef5f7d52e Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Mon, 27 Apr 2020 13:53:53 +0300 Subject: [PATCH] # Minor fixes --- Orchestrator/Settings/AccessUser_ND.py | 52 ++++++++++--------- ...l_Template.py => Template_ControlPanel.py} | 9 ++-- Orchestrator/Template_Settings_AccessUser.py | 32 ++++++++++++ 3 files changed, 65 insertions(+), 28 deletions(-) rename Orchestrator/{ControlPanel_Template.py => Template_ControlPanel.py} (95%) create mode 100644 Orchestrator/Template_Settings_AccessUser.py diff --git a/Orchestrator/Settings/AccessUser_ND.py b/Orchestrator/Settings/AccessUser_ND.py index 183a8ff1..7f359fc7 100644 --- a/Orchestrator/Settings/AccessUser_ND.py +++ b/Orchestrator/Settings/AccessUser_ND.py @@ -1,28 +1,32 @@ +# Init Section +gUserNameStr = "ND" # User name +gDomainNameStr = "" # DOMAIN or EMPTY str +gDomainIsDefaultBool = True # If domain is exist and is default (default = you can type login without domain name) + def SettingsUpdate(inDict): - ################################################## - #""/"ND" MethodMatchURLList - l__ND_RuleMethodMatchURLBeforeList={ - ("","ND"): { - "MethodMatchURLBeforeList": [ - { - "Method":"GET", - "MatchType":"Beginwith", - "URL":"/", - #"FlagAccessDefRequestGlobalAuthenticate": TestDef - "FlagAccess": True - }, - { - "Method":"POST", - "MatchType":"Beginwith", - "URL":"/", - #"FlagAccessDefRequestGlobalAuthenticate": TestDef - "FlagAccess": True - } - ], - "ControlPanelKeyAllowedList": ["TestControlPanel", "RobotRDPActive","RobotScreenActive", "ControlPanel_Template"] # If empty - all is allowed - } + lRuleDomainUserDict = { + "MethodMatchURLBeforeList": [ + { + "Method":"GET", + "MatchType":"Beginwith", + "URL":"/", + #"FlagAccessDefRequestGlobalAuthenticate": TestDef + "FlagAccess": True + }, + { + "Method":"POST", + "MatchType":"Beginwith", + "URL":"/", + #"FlagAccessDefRequestGlobalAuthenticate": TestDef + "FlagAccess": True + } + ], + "ControlPanelKeyAllowedList": ["TestControlPanel", "RobotRDPActive","RobotScreenActive", "ControlPanel_Template"] # If empty - all is allowed } - #Append to global list - inDict["Server"]["AccessUsers"]["RuleDomainUserDict"].update(l__ND_RuleMethodMatchURLBeforeList) + # Case add domain + user + inDict["Server"]["AccessUsers"]["RuleDomainUserDict"].update({(gDomainNameStr.upper(),gUserNameStr.upper()):lRuleDomainUserDict}) + if gDomainIsDefaultBool: + # Case add default domain + user + inDict["Server"]["AccessUsers"]["RuleDomainUserDict"].update({("",gUserNameStr.upper()):lRuleDomainUserDict}) #Return current dict return inDict \ No newline at end of file diff --git a/Orchestrator/ControlPanel_Template.py b/Orchestrator/Template_ControlPanel.py similarity index 95% rename from Orchestrator/ControlPanel_Template.py rename to Orchestrator/Template_ControlPanel.py index 04c0c312..def2e70e 100644 --- a/Orchestrator/ControlPanel_Template.py +++ b/Orchestrator/Template_ControlPanel.py @@ -84,10 +84,11 @@ def ControlPanelRenderDict(inGSettings): "DataStorageKey":gControlPanelKeyStr, # CLIENT SIDE:: Use key for set current dict in mGlobal.DataStorage["DataStorageKey"] on client side "SubheaderText":"", "BodyKeyValueList":[ - {"Key":"Info","Value":"1"}, - {"Key":"Info","Value":"2"}, - {"Key":"Info","Value":"3"}, - {"Key":"Statistic","Value":""} + {"Key":"Scheduler","Value":""}, + {"Key":"Start","Value":f"at {gActivityROBOTStartTimeHH_MMStr} in weekdays {gActivityROBOTStartWeekdayList}"}, + {"Key":"Stop (kill)","Value":f"at {gActivityROBOTStopTimeHH_MMStr} in weekdays {gActivityROBOTStopWeekdayList}"}, + {"Key":"Statistic","Value":""}, + {"Key":"...","Value":""} ], "FooterText":"Last update: 9:38:00 09.10.2019", "FooterButtonX2List":[ diff --git a/Orchestrator/Template_Settings_AccessUser.py b/Orchestrator/Template_Settings_AccessUser.py new file mode 100644 index 00000000..1b7febbd --- /dev/null +++ b/Orchestrator/Template_Settings_AccessUser.py @@ -0,0 +1,32 @@ +# Init Section +gUserNameStr = "Login" # User name without domain name +gDomainNameStr = "" # DOMAIN or EMPTY str if no domain +gDomainIsDefaultBool = True # If domain is exist and is default (default = you can type login without domain name) + +def SettingsUpdate(inDict): + lRuleDomainUserDict = { + "MethodMatchURLBeforeList": [ + { + "Method":"GET", + "MatchType":"Beginwith", + "URL":"/", + #"FlagAccessDefRequestGlobalAuthenticate": TestDef + "FlagAccess": True + }, + { + "Method":"POST", + "MatchType":"Beginwith", + "URL":"/", + #"FlagAccessDefRequestGlobalAuthenticate": TestDef + "FlagAccess": True + } + ], + "ControlPanelKeyAllowedList": ["TestControlPanel", "RobotRDPActive","RobotScreenActive", "ControlPanel_Template"] # If empty - all is allowed + } + # Case add domain + user + inDict["Server"]["AccessUsers"]["RuleDomainUserDict"].update({(gDomainNameStr.upper(),gUserNameStr.upper()):lRuleDomainUserDict}) + if gDomainIsDefaultBool: + # Case add default domain + user + inDict["Server"]["AccessUsers"]["RuleDomainUserDict"].update({("",gUserNameStr.upper()):lRuleDomainUserDict}) + #Return current dict + return inDict \ No newline at end of file