diff --git a/core/acs_util.js b/core/acs_util.js index effa64fa..fe111fe1 100644 --- a/core/acs_util.js +++ b/core/acs_util.js @@ -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]; diff --git a/misc/acs_parser.pegjs b/misc/acs_parser.pegjs index c97973d1..dc9e339e 100644 --- a/misc/acs_parser.pegjs +++ b/misc/acs_parser.pegjs @@ -16,7 +16,6 @@ return !isNaN(value) && user.getAge() >= value; }, AS : function accountStatus() { - if(_.isNumber(value)) { value = [ value ]; } @@ -82,16 +81,28 @@ return !isNaN(value) && client.term.termWidth >= value; }, ID : function isUserId(value) { - return user.userId === value; + if(_.isNumber(value)) { + value = [ value ]; + } + + assert(_.isArray(value)); + + return _.findIndex(value, function cmp(uid) { + return user.userId === parseInt(uid, 10); + }) > -1; }, WD : function isOneOfDayOfWeek() { - // :TODO: return true if DoW if(_.isNumber(value)) { - - } else if(_.isArray(value)) { - + value = [ value ]; } - return false; + + assert(_.isArray(value)); + + var nowDayOfWeek = new Date().getDay(); + + return _.findIndex(value, function cmp(dow) { + return nowDayOfWeek === parseInt(dow, 10); + }) > -1; }, MM : function isMinutesPastMidnight() { // :TODO: return true if value is >= minutes past midnight sys time diff --git a/mods/menu.hjson b/mods/menu.hjson index 689b9515..d9c03af3 100644 --- a/mods/menu.hjson +++ b/mods/menu.hjson @@ -307,9 +307,9 @@ { acs: AS2 next: fullLoginSequenceLoginArt - } + } { - acs: !AS2 + // acs: !AS2 next: newUserInactiveDone } ]