Skip to content

keyGet2 always returns *matcher result should be boolean or number* #332

@tomfriedhof

Description

@tomfriedhof

I have confirmed that the operator does in fact return the correct value. However, it is not making back from the coreEnforcer. This is what my stack trace looks like when running this:

      matcher result should be boolean or number

      at Enforcer.privateEnforce (/app/node_modules/casbin/lib/cjs/coreEnforcer.js:391:31)
      at privateEnforce.next (<anonymous>)
      at Object.generatorRunAsync (/app/node_modules/casbin/lib/cjs/util/util.js:154:41)
      at async testEnforce (/app/test/casbin/user.test.ts:34:20)
      at async /app/test/casbin/user.test.ts:25:9

I am running enforce with the following params:

const params = {
        sub: "role::sales",
        input: { sub, obj },
        obj: '/user/123',
        act: "ListUsers",
      };
await e.enforce(params.input, params.sub, params.obj, params.act);

Here is what the matcher looks like:

[matchers]
m = g(r.sub, p.sub) && keyGet2(r.obj, p.obj, 'role')

and policy:

p, /user/:role, role::sales, ListUsers

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions