Skip to content

Commit

Permalink
fix(*): allow _ in right name
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchuech authored and ds82 committed Jan 30, 2020
1 parent 9c15a16 commit 826b3e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions spec/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,15 @@ describe('access.js', function() {

expect(result).toBe(true);
});

it('test #2: is Allowed should return true', () => {
const has = ['filebrowser.local.read'];

const needs = 'filebrowser.local.read.jetflash_transcend_8gb_1';

const result = uut.isAllowed(has, needs);

expect(result).toBe(true);
});
});
});
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function checkOr(has, requires) {
has.forEach(function(right) {
requires.forEach(function(required) {
right = escapeRegExp(right);
var regExp = new RegExp('^' + right + '(\\.[a-zA-Z0-9\\.]*)*$');
var regExp = new RegExp('^' + right + '(\\.[a-zA-Z0-9_\\.]*)*$');
found = found || regExp.test(required);
});
});
Expand Down

0 comments on commit 826b3e6

Please sign in to comment.