* Some more JSON -> HJSON cleanup

* More work on ACS system conditional matching. Now functional within menus. Still more work to go on various ACS checks themselves.
* Use ACS for new user path: If new user requires activation, they will see 'DONE' then get logged off
This commit is contained in:
Bryan Ashby 2015-11-14 12:22:21 -07:00
parent 03f9ad4789
commit 688e46bc47
9 changed files with 93 additions and 68 deletions

View file

@ -792,6 +792,7 @@ module.exports = (function() {
var user = options.client.user;
var _ = require('lodash');
var assert = require('assert');
function checkAccess(acsCode, value) {
try {
@ -802,6 +803,18 @@ module.exports = (function() {
AG : function ageGreaterOrEqualThan() {
return !isNaN(value) && user.getAge() >= value;
},
AS : function accountStatus() {
if(_.isNumber(value)) {
value = [ value ];
}
assert(_.isArray(value));
return _.findIndex(value, function cmp(accStatus) {
return parseInt(accStatus, 10) === parseInt(user.properties.account_status, 10);
}) > -1;
},
EC : function isEncoding() {
switch(value) {
case 0 : return 'cp437' === client.term.outputEncoding.toLowerCase();
@ -814,13 +827,9 @@ module.exports = (function() {
return false;
}
value.forEach(function grpEntry(groupName) {
if(user.isGroupMember(groupName)) {
return true;
}
});
return false;
return _.findIndex(value, function cmp(groupName) {
return user.isGroupMember(groupName);
}) > - 1;
},
NN : function isNode() {
return client.node === value;