lundi 31 octobre 2016

Different strings in if statement

Anyone know how to check similar strings in the if...else statement?

My code below is to check whether a user is in the custom restricted permission group so the system can allow/decline the access.

if ((myMemberships.indexOf(Sitetitle + "  Restricted  Readers")>=0) {
        oInstance.model.dcn[0]._recordSet[i].isMember=false;

But I want to write an array that will store different string combinations of Sitetitle + " Restricted Readers" such as SiteTitle restricted reader(s), SiteTitleRestrictedReader(s), SiteTitle restrict reader(s). So I can prevent administrators typing the group name wrong when they create the group name, and eventually cause the code fail.

Aucun commentaire:

Enregistrer un commentaire