Customer access
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -41,48 +41,55 @@ namespace AyaNova.Models
|
||||
public TimeSpan WorkOrderCompleteByAge { get; set; } = TimeSpan.Zero;//was workorderclosebyage
|
||||
|
||||
public bool AllowScheduleConflicts { get; set; } = true;
|
||||
|
||||
|
||||
|
||||
|
||||
//CUSTOMER ACCESS FEATURES AND SETTINGS
|
||||
public long? CustomerDefaultWorkOrderReportId { get; set; }
|
||||
|
||||
public long? CustomerTagWorkOrderReport1Id { get; set; }
|
||||
public List<string> CustomerWorkOrderReport1Tags { get; set; } = new List<string>();
|
||||
|
||||
public long? CustomerTagWorkOrderReport2Id { get; set; }
|
||||
public List<string> CustomerWorkOrderReport2Tags { get; set; } = new List<string>();
|
||||
|
||||
public long? CustomerTagWorkOrderReport3Id { get; set; }
|
||||
public List<string> CustomerWorkOrderReport3Tags { get; set; } = new List<string>();
|
||||
|
||||
public long? CustomerTagWorkOrderReport4Id { get; set; }
|
||||
public List<string> CustomerWorkOrderReport4Tags { get; set; } = new List<string>();
|
||||
|
||||
public long? CustomerTagWorkOrderReport5Id { get; set; }
|
||||
public List<string> CustomerWorkOrderReport5Tags { get; set; } = new List<string>();
|
||||
|
||||
public string CustomerServiceRequestInfoText { get; set; }
|
||||
|
||||
public bool CustomerAllowCSR { get; set; }
|
||||
public List<string> CustomerAllowCSRInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowCSROutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowViewWO { get; set; }
|
||||
public List<string> CustomerAllowViewWOInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowViewWOOutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowWOWiki { get; set; }
|
||||
public List<string> CustomerAllowWOWikiInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowWOWikiOutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowUserSettings { get; set; }
|
||||
public List<string> CustomerAllowUserSettingsInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowUserSettingsOutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowNotifyServiceImminent { get; set; }
|
||||
public List<string> CustomerAllowNotifyServiceImminentInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowNotifyServiceImminentOutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowNotifyCSRAccepted { get; set; }
|
||||
public List<string> CustomerAllowNotifyCSRAcceptedInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowNotifyCSRAcceptedOutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowNotifyCSRRejected { get; set; }
|
||||
public List<string> CustomerAllowNotifyCSRRejectedInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowNotifyCSRRejectedOutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowNotifyWOCreated { get; set; }
|
||||
public List<string> CustomerAllowNotifyWOCreatedInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowNotifyWOCreatedOutTags { get; set; } = new List<string>();
|
||||
|
||||
public bool CustomerAllowNotifyWOCompleted { get; set; }
|
||||
public List<string> CustomerAllowNotifyWOCompletedInTags { get; set; } = new List<string>();
|
||||
public List<string> CustomerAllowNotifyWOCompletedOutTags { get; set; } = new List<string>();
|
||||
|
||||
public string SignatureTitle { get; set; }
|
||||
public string SignatureHeader { get; set; }
|
||||
|
||||
@@ -263,15 +263,15 @@ namespace AyaNova.Util
|
||||
+ "signaturefooter TEXT, "
|
||||
|
||||
+ "customerservicerequestinfotext TEXT, "
|
||||
+ "customerallowcsr BOOL DEFAULT FALSE, customerallowcsrintags VARCHAR(255) ARRAY, customerallowcsrouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallowviewwo BOOL DEFAULT FALSE, customerallowviewwointags VARCHAR(255) ARRAY, customerallowviewwoouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallowwowiki BOOL DEFAULT FALSE, customerallowwowikiintags VARCHAR(255) ARRAY, customerallowwowikiouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallowusersettings BOOL DEFAULT FALSE, customerallowusersettingsintags VARCHAR(255) ARRAY, customerallowusersettingsouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifyserviceimminent BOOL DEFAULT FALSE, customerallownotifyserviceimminentintags VARCHAR(255) ARRAY, customerallownotifyserviceimminentouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifycsraccepted BOOL DEFAULT FALSE, customerallownotifycsracceptedintags VARCHAR(255) ARRAY, customerallownotifycsracceptedouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifycsrrejected BOOL DEFAULT FALSE, customerallownotifycsrrejectedintags VARCHAR(255) ARRAY, customerallownotifycsrrejectedouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifywocreated BOOL DEFAULT FALSE, customerallownotifywocreatedintags VARCHAR(255) ARRAY, customerallownotifywocreatedouttags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifywocompleted BOOL DEFAULT FALSE, customerallownotifywocompletedintags VARCHAR(255) ARRAY, customerallownotifywocompletedouttags VARCHAR(255) ARRAY "
|
||||
+ "customerallowcsr BOOL DEFAULT FALSE, customerallowcsrintags VARCHAR(255) ARRAY, "
|
||||
+ "customerallowviewwo BOOL DEFAULT FALSE, customerallowviewwointags VARCHAR(255) ARRAY, "
|
||||
+ "customerallowwowiki BOOL DEFAULT FALSE, customerallowwowikiintags VARCHAR(255) ARRAY, "
|
||||
+ "customerallowusersettings BOOL DEFAULT FALSE, customerallowusersettingsintags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifyserviceimminent BOOL DEFAULT FALSE, customerallownotifyserviceimminentintags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifycsraccepted BOOL DEFAULT FALSE, customerallownotifycsracceptedintags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifycsrrejected BOOL DEFAULT FALSE, customerallownotifycsrrejectedintags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifywocreated BOOL DEFAULT FALSE, customerallownotifywocreatedintags VARCHAR(255) ARRAY, "
|
||||
+ "customerallownotifywocompleted BOOL DEFAULT FALSE, customerallownotifywocompletedintags VARCHAR(255) ARRAY"
|
||||
+ ")");
|
||||
|
||||
//create global ops BACKUP settings table
|
||||
|
||||
Reference in New Issue
Block a user