casbin 5.15.0 → 5.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/lib/cjs/coreEnforcer.js +4 -2
- package/lib/cjs/effect/defaultEffectorStream.d.ts +2 -1
- package/lib/cjs/effect/defaultEffectorStream.js +10 -1
- package/lib/cjs/effect/effectorStream.d.ts +1 -1
- package/lib/esm/coreEnforcer.js +4 -2
- package/lib/esm/effect/defaultEffectorStream.d.ts +2 -1
- package/lib/esm/effect/defaultEffectorStream.js +10 -1
- package/lib/esm/effect/effectorStream.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [5.15.1](https://github.com/casbin/node-casbin/compare/v5.15.0...v5.15.1) (2022-04-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* EnforceEx return allow reason ([#363](https://github.com/casbin/node-casbin/issues/363)) ([6353283](https://github.com/casbin/node-casbin/commit/635328328caf200093e89443d32e9f2fa736509a))
|
|
7
|
+
|
|
1
8
|
# [5.15.0](https://github.com/casbin/node-casbin/compare/v5.14.0...v5.15.0) (2022-04-15)
|
|
2
9
|
|
|
3
10
|
|
package/lib/cjs/coreEnforcer.js
CHANGED
|
@@ -410,9 +410,11 @@ class CoreEnforcer {
|
|
|
410
410
|
eftRes = effect_1.Effect.Indeterminate;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
const [res, done] = effectStream.pushEffect(eftRes);
|
|
414
|
-
if (
|
|
413
|
+
const [res, rec, done] = effectStream.pushEffect(eftRes);
|
|
414
|
+
if (rec) {
|
|
415
415
|
explainIndex = i;
|
|
416
|
+
}
|
|
417
|
+
if (done) {
|
|
416
418
|
break;
|
|
417
419
|
}
|
|
418
420
|
}
|
|
@@ -6,8 +6,9 @@ import { Effect } from './effector';
|
|
|
6
6
|
export declare class DefaultEffectorStream implements EffectorStream {
|
|
7
7
|
private done;
|
|
8
8
|
private res;
|
|
9
|
+
private rec;
|
|
9
10
|
private readonly expr;
|
|
10
11
|
constructor(expr: string);
|
|
11
12
|
current(): boolean;
|
|
12
|
-
pushEffect(eft: Effect): [boolean, boolean];
|
|
13
|
+
pushEffect(eft: Effect): [boolean, boolean, boolean];
|
|
13
14
|
}
|
|
@@ -22,6 +22,7 @@ class DefaultEffectorStream {
|
|
|
22
22
|
constructor(expr) {
|
|
23
23
|
this.done = false;
|
|
24
24
|
this.res = false;
|
|
25
|
+
this.rec = false;
|
|
25
26
|
this.expr = expr;
|
|
26
27
|
}
|
|
27
28
|
current() {
|
|
@@ -33,6 +34,7 @@ class DefaultEffectorStream {
|
|
|
33
34
|
if (eft === effector_1.Effect.Allow) {
|
|
34
35
|
this.res = true;
|
|
35
36
|
this.done = true;
|
|
37
|
+
this.rec = true;
|
|
36
38
|
}
|
|
37
39
|
break;
|
|
38
40
|
case '!some(where (p_eft == deny))':
|
|
@@ -40,27 +42,34 @@ class DefaultEffectorStream {
|
|
|
40
42
|
if (eft === effector_1.Effect.Deny) {
|
|
41
43
|
this.res = false;
|
|
42
44
|
this.done = true;
|
|
45
|
+
this.rec = true;
|
|
43
46
|
}
|
|
44
47
|
break;
|
|
45
48
|
case 'some(where (p_eft == allow)) && !some(where (p_eft == deny))':
|
|
46
49
|
if (eft === effector_1.Effect.Allow) {
|
|
47
50
|
this.res = true;
|
|
51
|
+
this.rec = true;
|
|
48
52
|
}
|
|
49
53
|
else if (eft === effector_1.Effect.Deny) {
|
|
50
54
|
this.res = false;
|
|
51
55
|
this.done = true;
|
|
56
|
+
this.rec = true;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.rec = false;
|
|
52
60
|
}
|
|
53
61
|
break;
|
|
54
62
|
case 'priority(p_eft) || deny':
|
|
55
63
|
if (eft !== effector_1.Effect.Indeterminate) {
|
|
56
64
|
this.res = eft === effector_1.Effect.Allow;
|
|
57
65
|
this.done = true;
|
|
66
|
+
this.rec = true;
|
|
58
67
|
}
|
|
59
68
|
break;
|
|
60
69
|
default:
|
|
61
70
|
throw new Error('unsupported effect');
|
|
62
71
|
}
|
|
63
|
-
return [this.res, this.done];
|
|
72
|
+
return [this.res, this.rec, this.done];
|
|
64
73
|
}
|
|
65
74
|
}
|
|
66
75
|
exports.DefaultEffectorStream = DefaultEffectorStream;
|
package/lib/esm/coreEnforcer.js
CHANGED
|
@@ -407,9 +407,11 @@ export class CoreEnforcer {
|
|
|
407
407
|
eftRes = Effect.Indeterminate;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
const [res, done] = effectStream.pushEffect(eftRes);
|
|
411
|
-
if (
|
|
410
|
+
const [res, rec, done] = effectStream.pushEffect(eftRes);
|
|
411
|
+
if (rec) {
|
|
412
412
|
explainIndex = i;
|
|
413
|
+
}
|
|
414
|
+
if (done) {
|
|
413
415
|
break;
|
|
414
416
|
}
|
|
415
417
|
}
|
|
@@ -6,8 +6,9 @@ import { Effect } from './effector';
|
|
|
6
6
|
export declare class DefaultEffectorStream implements EffectorStream {
|
|
7
7
|
private done;
|
|
8
8
|
private res;
|
|
9
|
+
private rec;
|
|
9
10
|
private readonly expr;
|
|
10
11
|
constructor(expr: string);
|
|
11
12
|
current(): boolean;
|
|
12
|
-
pushEffect(eft: Effect): [boolean, boolean];
|
|
13
|
+
pushEffect(eft: Effect): [boolean, boolean, boolean];
|
|
13
14
|
}
|
|
@@ -19,6 +19,7 @@ export class DefaultEffectorStream {
|
|
|
19
19
|
constructor(expr) {
|
|
20
20
|
this.done = false;
|
|
21
21
|
this.res = false;
|
|
22
|
+
this.rec = false;
|
|
22
23
|
this.expr = expr;
|
|
23
24
|
}
|
|
24
25
|
current() {
|
|
@@ -30,6 +31,7 @@ export class DefaultEffectorStream {
|
|
|
30
31
|
if (eft === Effect.Allow) {
|
|
31
32
|
this.res = true;
|
|
32
33
|
this.done = true;
|
|
34
|
+
this.rec = true;
|
|
33
35
|
}
|
|
34
36
|
break;
|
|
35
37
|
case '!some(where (p_eft == deny))':
|
|
@@ -37,26 +39,33 @@ export class DefaultEffectorStream {
|
|
|
37
39
|
if (eft === Effect.Deny) {
|
|
38
40
|
this.res = false;
|
|
39
41
|
this.done = true;
|
|
42
|
+
this.rec = true;
|
|
40
43
|
}
|
|
41
44
|
break;
|
|
42
45
|
case 'some(where (p_eft == allow)) && !some(where (p_eft == deny))':
|
|
43
46
|
if (eft === Effect.Allow) {
|
|
44
47
|
this.res = true;
|
|
48
|
+
this.rec = true;
|
|
45
49
|
}
|
|
46
50
|
else if (eft === Effect.Deny) {
|
|
47
51
|
this.res = false;
|
|
48
52
|
this.done = true;
|
|
53
|
+
this.rec = true;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.rec = false;
|
|
49
57
|
}
|
|
50
58
|
break;
|
|
51
59
|
case 'priority(p_eft) || deny':
|
|
52
60
|
if (eft !== Effect.Indeterminate) {
|
|
53
61
|
this.res = eft === Effect.Allow;
|
|
54
62
|
this.done = true;
|
|
63
|
+
this.rec = true;
|
|
55
64
|
}
|
|
56
65
|
break;
|
|
57
66
|
default:
|
|
58
67
|
throw new Error('unsupported effect');
|
|
59
68
|
}
|
|
60
|
-
return [this.res, this.done];
|
|
69
|
+
return [this.res, this.rec, this.done];
|
|
61
70
|
}
|
|
62
71
|
}
|
package/package.json
CHANGED