2015-11-11 06:05:42 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
var user = options.user;
|
2015-11-11 06:16:14 +00:00
|
|
|
var client = options.client;
|
2015-11-11 06:05:42 +00:00
|
|
|
|
|
|
|
function checkAcs(name, value) {
|
|
|
|
return {
|
2015-11-11 06:16:14 +00:00
|
|
|
SC : function secureConnection() {
|
|
|
|
return client.session.isSecure;
|
|
|
|
},
|
2015-11-11 06:05:42 +00:00
|
|
|
ID : function userId(value) {
|
|
|
|
return user.userId === value;
|
|
|
|
}
|
|
|
|
}[name](value) || false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function check(name, value) {
|
|
|
|
// Dummy implementation: returns true when the name starts with 'A'
|
|
|
|
return name.charAt(0) == 'A';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
start
|
|
|
|
= expr
|
|
|
|
|
|
|
|
expr
|
|
|
|
= or_expr
|
|
|
|
|
|
|
|
or_expr
|
|
|
|
= left:and_expr '|' right:expr { return left || right; }
|
|
|
|
/ and_expr
|
|
|
|
|
|
|
|
and_expr
|
|
|
|
= left:not_expr '&'? right:expr { return left && right; }
|
|
|
|
/ not_expr
|
|
|
|
|
|
|
|
not_expr
|
|
|
|
= '!' value:atom { return !value; }
|
|
|
|
/ atom
|
|
|
|
|
|
|
|
atom
|
|
|
|
= acs_check
|
|
|
|
/ '(' value:expr ')' { return value; }
|
|
|
|
|
|
|
|
comma = ','
|
|
|
|
ws = ' '
|
|
|
|
|
|
|
|
optionalSpc = ws*
|
|
|
|
|
|
|
|
acs_check
|
|
|
|
= n:name a:arg { return checkAcs(n, a); }
|
|
|
|
|
|
|
|
name
|
|
|
|
= c:([A-Z][A-Z]) { return c.join(''); }
|
|
|
|
|
|
|
|
argNum
|
|
|
|
= c:[A-Za-z]+ { return c.join('') }
|
|
|
|
|
|
|
|
argVar
|
|
|
|
= a:[A-Za-z0-9\-]+ { return a.join('') }
|
|
|
|
|
|
|
|
commaList
|
|
|
|
= start:(v:argVar comma { return v; })* last:argVar { return start.concat(last); }
|
|
|
|
|
|
|
|
allList
|
|
|
|
= '{' l:commaList '}' { return l; }
|
|
|
|
|
|
|
|
anyList
|
|
|
|
= '[' l:commaList ']' { return l; }
|
|
|
|
|
|
|
|
arg
|
|
|
|
= allList
|
|
|
|
/ anyList
|
|
|
|
/ c:[A-Za-z]+ { return c.join(''); }
|
|
|
|
/ d:[0-9]* { return d ? parseInt(d.join(''), 10) : null; }
|
|
|
|
|