Customer access

This commit is contained in:
2021-11-12 20:49:31 +00:00
parent b3f36de12c
commit 98d495dfd2
4 changed files with 43 additions and 51 deletions

View File

@@ -145,48 +145,39 @@ namespace AyaNova.Biz
return new CustomerRightsRecord(
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowCSR,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowCSRInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowCSROutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowCSRInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowViewWO,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowViewWOInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowViewWOOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowViewWOInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowWOWiki,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowWOWikiInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowWOWikiOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowWOWikiInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowUserSettings,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowUserSettingsInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowUserSettingsOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowUserSettingsInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyServiceImminent,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyServiceImminentInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyServiceImminentOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyServiceImminentInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRAccepted,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRAcceptedInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRAcceptedOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRAcceptedInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRRejected,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRRejectedInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRRejectedOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyCSRRejectedInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCreated,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCreatedInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCreatedOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCreatedInTags),
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCompleted,
AllTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCompletedInTags,
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCompletedOutTags),
AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowNotifyWOCompletedInTags),
EntityId,
EntityActive
);
@@ -195,25 +186,22 @@ namespace AyaNova.Biz
}
private static bool CustomerUserEffectiveRightsAllowed(bool allowed, List<string> contactTags, List<string> inTags, List<string> outTags)
private static bool CustomerUserEffectiveRightsAllowed(bool allowed, List<string> contactTags, List<string> inTags)
{
//Note: tag match rule as planned and documented is that it's a match if *any* single tag in intags or outtags are a match to any single tag in contact tags,
//Note: tag match rule as planned and documented is that it's a match if *any* single tag in intags are a match to any single tag in contact tags,
//not the whole list, just any one of them which differs from how notifications are checked for example which need to *all* match
//if outright banned then quickest short circuit here
if (!allowed) return false;
//No tags to verify means allowed
if (inTags.Count == 0 && outTags.Count == 0) return true;
if (inTags.Count == 0 ) return true;
//if contact tags is empty and inclusive is empty then it's a match and can short circuit
if (contactTags.Count == 0 && inTags.Count == 0) return true;
if (contactTags.Count == 0) return true;
//if contact tags is empty and inclusive is not empty then no match is possible
if (contactTags.Count == 0 && inTags.Count > 0) return false;
//any of the exclusive tags in contact tags?
if (contactTags.Intersect(outTags).Any()) return false;
if (contactTags.Count == 0 ) return false;
//any of the inclusive tags in contact tags?
if (contactTags.Intersect(inTags).Any()) return true;