Comments (9)
YES. It is match all policy.
from node-casbin.
Hi @Jarvie8176 , node-casbin internally uses expression-eval to evaluate the matcher. Probably it doesn't support short-circuit. If you want this feature, you can ask this in their repo's issues.
from node-casbin.
Hi @Jarvie8176 , node-casbin internally uses expression-eval to evaluate the matcher. Probably it doesn't support short-circuit. If you want this feature, you can ask this in their repo's issues.
Do you mean keyMatch()
should match all policies in this case?
from node-casbin.
Casbin need call policy_effect determines the return value after match all polices.
from node-casbin.
The test would pass if I used regexMatch()
instead of keyMatch()
. I think my question is what should keyMatch("alice:res1:A", "alice:*:B")
return?
from node-casbin.
Hi @Jarvie8176 , keyMatch("alice:res1:A", "alice:*:B")
should return false. See:
from node-casbin.
I wrote a failing test here: Jarvie8176@d66e4a1
It looks like keyMatch()
's precondition is that the wildcard, if exists, should be the last character in key2
but that is not satisfied in this case. To match wildcard properly you may have to implement a DP algorithm. Would you consider using utility libraries (e.g. matcher or minimatch) to offload complexity?
from node-casbin.
@Jarvie8176 Looking good, our team needs to discuss.
from node-casbin.
@Jarvie8176 keyMatch()
assumes that * is the last character of the string. It is not designed to handle cases like alice:*:B
. Please use regexMatch()
for your scenario. You can add your own custom function to Casbin too.
from node-casbin.
Related Issues (20)
- Problem "invalid group" with v5.24.4 and later HOT 10
- `RBAC with Domains API` # `e.getUsersForRoleInDomain` doesn't work. HOT 3
- FileAdapter doesn't escape values when saving policy HOT 6
- [Question] Policy_effect 'deny' does not work when combining multiple models in one model configuration HOT 3
- Prefered way to use casbin in a web framework with lots of users? HOT 2
- No Cloudflare Workers support? HOT 2
- Casbin Watcher for Prisma ORM HOT 4
- Add to Nest.js docs HOT 1
- KeyMatch5 does not match the expected result HOT 1
- [email protected]: The expression-eval npm package is no longer maintained HOT 5
- [feature] ABAC support for EnableAcceptJsonRequest() HOT 2
- enforcer.deleteUser() wiped out all data from `casbin_rule` table HOT 1
- Without enforcer.loadPolicy() Casbin behave unpredictably on mass updates. HOT 1
- [Bug] Can't resolve 'fs' HOT 7
- [bug] When using ‘watcherEx’, deletion does not trigger it; you need to configure a ‘watcher’ for it to work. HOT 2
- [Bug] The lack of a constructor results in the default configuration not taking effect. HOT 3
- addMatchingFunc HOT 2
- usage of addMatchingFunc HOT 2
- [Question] Can the cache stored in memory here be placed in Redis? HOT 3
- Why I can't use enforcer to judge the req using the rbac modle? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-casbin.