filter parsing turning presence filter into substring filter
This commit is contained in:
parent
b8c86cc7d2
commit
344cac0287
|
@ -58,9 +58,7 @@ Filter.prototype.toBer = function (ber) {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* Test a rule against one or more values.
|
||||
*/
|
||||
// Test a rule against one or more values.
|
||||
Filter.multi_test = function (rule, value) {
|
||||
if (Array.isArray(value)) {
|
||||
var response = false;
|
||||
|
|
|
@ -144,7 +144,7 @@ function _buildFilterTree(expr) {
|
|||
// substrings fall into the equality bin in the
|
||||
// switch above so we need more processing here
|
||||
if (tree.tag === 'equalityMatch') {
|
||||
if (tree.value.length === 0) {
|
||||
if (tree.value === '*') {
|
||||
tree.tag = 'present';
|
||||
} else {
|
||||
|
||||
|
|
|
@ -113,3 +113,13 @@ test('GH-53 NotFilter', function (t) {
|
|||
t.equal(f.filters[1].filter.value, 'shadowAccount');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('presence filter', function (t) {
|
||||
var str = '(foo=*)';
|
||||
var f = parse(str);
|
||||
t.ok(f);
|
||||
t.equal(f.type, 'present');
|
||||
t.equal(f.attribute, 'foo');
|
||||
t.end();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue