* ACS checks in 'next' blocks can now have a default "catch all" by simply omitting the 'acs' portion of a condition

This commit is contained in:
Bryan Ashby 2015-11-14 17:51:05 -07:00
parent 688e46bc47
commit 48c12ddffb
3 changed files with 31 additions and 10 deletions

View file

@ -15,8 +15,18 @@ function getConditionalValue(client, condArray, memberName) {
assert(_.isString(memberName));
var matchCond = _.find(condArray, function cmp(cond) {
return acsParser.parse(cond.acs, { client : client } );
return _.has(cond, 'acs') && acsParser.parse(cond.acs, { client : client } );
});
//
// If no matchCond, look for a default entry. That is,
// a entry without a 'acs' string.
//
if(!matchCond) {
matchCond = _.find(condArray, function cmp(cond) {
return !_.has(cond, 'acs');
});
}
if(matchCond) {
return matchCond[memberName];