We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
&&
I used multi in and && syntax as matchers,if conditions is true && true, got result is false, but i expect result is true, this is a bug?
in
true && true
The below is my test codes
const fs = require('fs') const path = require('path') const Casbin = require('casbin') const model1Text = `[request_definition] r = sub, obj, act [policy_definition] p = sub, obj, act [policy_effect] e = some(where (p.eft == allow)) [matchers] m = r.act in "('In', 'Out')"` const model2Text = `[request_definition] r = sub, obj, act [policy_definition] p = sub, obj, act [policy_effect] e = some(where (p.eft == allow)) [matchers] m = r.sub in "('root', 'guest')"` const model3Text = `[request_definition] r = sub, obj, act [policy_definition] p = sub, obj, act [policy_effect] e = some(where (p.eft == allow)) [matchers] m = r.act in "('In', 'Out')" && r.sub in "('root', 'guest')"` ; (async () => { // initial models const path1 = path.resolve(__dirname, './model1.conf') const path2 = path.resolve(__dirname, './model2.conf') const path3 = path.resolve(__dirname, './model3.conf') fs.writeFileSync(path1, model1Text) fs.writeFileSync(path2, model2Text) fs.writeFileSync(path3, model3Text) // loading enforcer const enforcer1 = await Casbin.newEnforcer(path1) const enforcer2 = await Casbin.newEnforcer(path2) const enforcer3 = await Casbin.newEnforcer(path3) // test const result1 = await enforcer1.enforce('root', {}, 'In') const result2 = await enforcer2.enforce('root', {}, 'In') const result3 = await enforcer3.enforce('root', {}, 'In') console.log('result1 : ', result1) // true console.log('result2 : ', result2) // true console.log('result3 : ', result3) // false })();
The text was updated successfully, but these errors were encountered:
@Zxilly @Gabriel-403
Sorry, something went wrong.
@lantu-group matchers should be m = r.act in ['In', 'Out'] && r.sub in ['root', 'guest']
matchers
m = r.act in ['In', 'Out'] && r.sub in ['root', 'guest']
Ref discussion: casbin/casbin#863
🎉 This issue has been resolved in version 5.11.3 🎉
The release is available on:
Your semantic-release bot 📦🚀
hsluoyz
Successfully merging a pull request may close this issue.
I used multi
in
and&&
syntax as matchers,if conditions istrue && true
, got result is false, but i expect result is true, this is a bug?The below is my test codes
The text was updated successfully, but these errors were encountered: