Closed Gabriel-403 closed 3 years ago
Totals | |
---|---|
Change from base Build 1153544760: | 0.04% |
Covered Lines: | 1329 |
Relevant Lines: | 1674 |
Totals | |
---|---|
Change from base Build 1153544760: | 0.04% |
Covered Lines: | 1329 |
Relevant Lines: | 1674 |
@Gabriel-403 please add unit tests for this feature.
@Gabriel-403 You should keep consistent with the implementation of golang version.
@Gabriel-403 You should keep consistent with the implementation of golang version.
Agree with @nodece. Casbin in Go uses a suffix to identify different enforcer contexts. You can refer to the implementation:
Implementation: https://github.com/casbin/casbin/blob/master/enforcer.go#L457 Usage example: https://github.com/casbin/casbin/blob/master/enforcer_test.go#L534
I think you can make a minor change so we can keep a same solution to multi policies in diverse Casbin project.
@kingiw ok,Already completed!
Besides, maybe you should fetch the origin repo, rebase locally and resolve the conflicts before making a pr.
@Gabriel-403 plz resolve git conflicts locally
Replaced by: https://github.com/casbin/casbin.js/pull/176
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/coreEnforcer.ts | 8 | 9 | 88.89% | ||
<!-- | Total: | 11 | 12 | 91.67% | --> |
Totals | |
---|---|
Change from base Build 1153544760: | 0.04% |
Covered Lines: | 1329 |
Relevant Lines: | 1674 |
If you need multiple policy definitions or multiple matcher, you can use like p2, m2. In fact, all of the above four sections can use multiple types and the syntax is r+number, such as r2, e2. By default these four sections should correspond one to one. Such as your r2 will only use matcher m2 to match policies p2.