Skip to content

Commit

Permalink
fix: Revert "fix: escape assertion bug (#394)" (#398)
Browse files Browse the repository at this point in the history
This reverts commit 5a339d8.
  • Loading branch information
hsluoyz authored Nov 12, 2022
1 parent e3b23b8 commit 6127584
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 31 deletions.
11 changes: 0 additions & 11 deletions examples/abac_attr_model.conf

This file was deleted.

2 changes: 0 additions & 2 deletions examples/abac_attr_policy.csv

This file was deleted.

6 changes: 2 additions & 4 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import * as fs from 'fs';
// escapeAssertion escapes the dots in the assertion,
// because the expression evaluation doesn't support such variable names.
function escapeAssertion(s: string): string {
s = ' ' + s;
s = s.replace(/(?<=[\(| ])r\./g, 'r_');
s = s.replace(/(?<=[\(| ])p\./g, 'p_');
s = s.trim();
s = s.replace(/r\./g, 'r_');
s = s.replace(/p\./g, 'p_');
return s;
}

Expand Down
14 changes: 0 additions & 14 deletions test/enforcer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,17 +697,3 @@ test('TestEnforceExWithPriorityModel', async () => {
testEnforceEx(e, 'bob', 'data2', 'read', [true, ['data2_allow_group', 'data2', 'read', 'allow']]);
testEnforceEx(e, 'alice', 'data2', 'read', [false, []]);
});

test('TestABACAtrrModel', async () => {
const e = await newEnforcer('examples/abac_attr_model.conf', 'examples/abac_attr_policy.csv');
expect(
await e.enforce(
{
attr: {
id: 'alice',
},
},
'read'
)
).toBe(true);
});

0 comments on commit 6127584

Please sign in to comment.