|
|
@ -146,7 +146,8 @@ def UserAccessCheckBefore(inMethod, inRequest):
|
|
|
|
########################################
|
|
|
|
########################################
|
|
|
|
#Check general before rule (without User domain)
|
|
|
|
#Check general before rule (without User domain)
|
|
|
|
#Check rules
|
|
|
|
#Check rules
|
|
|
|
for lAccessRuleItem in gSettingsDict.get("ServerDict", {}).get("AccessUsers", {}).get("RuleMethodMatchURLBeforeList", []):
|
|
|
|
inRuleMatchURLList = gSettingsDict.get("ServerDict", {}).get("AccessUsers", {}).get("RuleMethodMatchURLBeforeList", [])
|
|
|
|
|
|
|
|
for lAccessRuleItem in inRuleMatchURLList:
|
|
|
|
#Go next execution if flag is false
|
|
|
|
#Go next execution if flag is false
|
|
|
|
if not lResult:
|
|
|
|
if not lResult:
|
|
|
|
#Check if Method is identical
|
|
|
|
#Check if Method is identical
|
|
|
@ -178,31 +179,35 @@ def UserAccessCheckBefore(inMethod, inRequest):
|
|
|
|
#Check access by User Domain
|
|
|
|
#Check access by User Domain
|
|
|
|
#Check rules to find first appicable
|
|
|
|
#Check rules to find first appicable
|
|
|
|
#Check rules
|
|
|
|
#Check rules
|
|
|
|
for lAccessRuleItem in gSettingsDict.get("ServerDict", {}).get("AccessUsers", {}).get("RuleDomainUserDict", {}).get((lUserDict["Domain"].upper(), lUserDict["User"].upper()), {}).get("MethodMatchURLBeforeList", []):
|
|
|
|
lMethodMatchURLList = gSettingsDict.get("ServerDict", {}).get("AccessUsers", {}).get("RuleDomainUserDict", {}).get((lUserDict["Domain"].upper(), lUserDict["User"].upper()), {}).get("MethodMatchURLBeforeList", [])
|
|
|
|
#Go next execution if flag is false
|
|
|
|
if len(lMethodMatchURLList) > 0:
|
|
|
|
if not lResult:
|
|
|
|
for lAccessRuleItem in lMethodMatchURLList:
|
|
|
|
#Check if Method is identical
|
|
|
|
#Go next execution if flag is false
|
|
|
|
if lAccessRuleItem["Method"].upper() == inMethod:
|
|
|
|
if not lResult:
|
|
|
|
#check Match type variant: BeginWith
|
|
|
|
#Check if Method is identical
|
|
|
|
if lAccessRuleItem["MatchType"].upper() == "BEGINWITH":
|
|
|
|
if lAccessRuleItem["Method"].upper() == inMethod:
|
|
|
|
lURLPath = inRequest.path
|
|
|
|
#check Match type variant: BeginWith
|
|
|
|
lURLPath = lURLPath.upper()
|
|
|
|
if lAccessRuleItem["MatchType"].upper() == "BEGINWITH":
|
|
|
|
if lURLPath.startswith(lAccessRuleItem["URL"].upper()):
|
|
|
|
lURLPath = inRequest.path
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
lURLPath = lURLPath.upper()
|
|
|
|
#check Match type variant: Contains
|
|
|
|
if lURLPath.startswith(lAccessRuleItem["URL"].upper()):
|
|
|
|
elif lAccessRuleItem["MatchType"].upper() == "CONTAINS":
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
lURLPath = inRequest.path
|
|
|
|
#check Match type variant: Contains
|
|
|
|
lURLPath = lURLPath.upper()
|
|
|
|
elif lAccessRuleItem["MatchType"].upper() == "CONTAINS":
|
|
|
|
if lURLPath.contains(lAccessRuleItem["URL"].upper()):
|
|
|
|
lURLPath = inRequest.path
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
lURLPath = lURLPath.upper()
|
|
|
|
# check Match type variant: Equal
|
|
|
|
if lURLPath.contains(lAccessRuleItem["URL"].upper()):
|
|
|
|
elif lAccessRuleItem["MatchType"].upper() == "EQUAL":
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
if lAccessRuleItem["URL"].upper() == inRequest.path.upper():
|
|
|
|
# check Match type variant: Equal
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
elif lAccessRuleItem["MatchType"].upper() == "EQUAL":
|
|
|
|
# check Match type variant: EqualCase
|
|
|
|
if lAccessRuleItem["URL"].upper() == inRequest.path.upper():
|
|
|
|
elif lAccessRuleItem["MatchType"].upper() == "EQUALCASE":
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
if lAccessRuleItem["URL"] == inRequest.path:
|
|
|
|
# check Match type variant: EqualCase
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
elif lAccessRuleItem["MatchType"].upper() == "EQUALCASE":
|
|
|
|
|
|
|
|
if lAccessRuleItem["URL"] == inRequest.path:
|
|
|
|
|
|
|
|
lResult = HelpGetFlag(lAccessRuleItem, inRequest, gSettingsDict, lUserDict)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return True
|
|
|
|
#####################################
|
|
|
|
#####################################
|
|
|
|
#####################################
|
|
|
|
#####################################
|
|
|
|
#Return lResult
|
|
|
|
#Return lResult
|
|
|
|