casbin 5.27.1 → 5.29.0

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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [5.29.0](https://github.com/casbin/node-casbin/compare/v5.28.0...v5.29.0) (2024-04-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * update CI Node.js version to 18 and 20 ([4aa74ab](https://github.com/casbin/node-casbin/commit/4aa74ab710aa300c172c71b802453dd64b3ec1a7))
7
+
8
+ # [5.28.0](https://github.com/casbin/node-casbin/compare/v5.27.1...v5.28.0) (2023-11-21)
9
+
10
+
11
+ ### Features
12
+
13
+ * fix WatcherEx not triggered issue ([61c1595](https://github.com/casbin/node-casbin/commit/61c159533904f38d82eb0418a1de949666cc381a))
14
+
1
15
  ## [5.27.1](https://github.com/casbin/node-casbin/compare/v5.27.0...v5.27.1) (2023-09-19)
2
16
 
3
17
 
package/README.md CHANGED
@@ -14,6 +14,20 @@
14
14
  [download-image]: https://img.shields.io/npm/dm/casbin.svg?style=flat-square
15
15
  [download-url]: https://npmjs.org/package/casbin
16
16
 
17
+ <p align="center">
18
+ <sup>Sponsored by</sup>
19
+ <br>
20
+ <a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_campaign=casbin">
21
+ <picture>
22
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.casbin.org/img/stytch-white.png">
23
+ <source media="(prefers-color-scheme: light)" srcset="https://cdn.casbin.org/img/stytch-charcoal.png">
24
+ <img src="https://cdn.casbin.org/img/stytch-charcoal.png" width="275">
25
+ </picture>
26
+ </a><br/>
27
+ <a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_campaign=casbin"><b>Build auth with fraud prevention, faster.</b><br/> Try Stytch for API-first authentication, user & org management, multi-tenant SSO, MFA, device fingerprinting, and more.</a>
28
+ <br>
29
+ </p>
30
+
17
31
  💖 [**Looking for an open-source identity and access management solution like Okta, Auth0, Keycloak ? Learn more about: Casdoor**](https://casdoor.org/)
18
32
 
19
33
  <a href="https://casdoor.org/"><img src="https://user-images.githubusercontent.com/3787410/147868267-6ac74908-5654-4f9c-ac79-8852af9ff925.png" alt="casdoor" style="width: 50%; height: 50%"/></a>
@@ -117,10 +117,12 @@ class InternalEnforcer extends coreEnforcer_1.CoreEnforcer {
117
117
  }
118
118
  }
119
119
  if (useWatcher) {
120
- if (this.watcher && this.autoNotifyWatcher) {
120
+ if (this.autoNotifyWatcher) {
121
121
  // In fact I think it should wait for the respond, but they implement add_policy() like this
122
122
  // error intentionally ignored
123
- this.watcher.update();
123
+ if (this.watcher) {
124
+ this.watcher.update();
125
+ }
124
126
  }
125
127
  }
126
128
  const ok = this.model.updatePolicy(sec, ptype, oldRule, newRule);
@@ -148,7 +150,7 @@ class InternalEnforcer extends coreEnforcer_1.CoreEnforcer {
148
150
  }
149
151
  }
150
152
  if (useWatcher) {
151
- if (this.watcher && this.autoNotifyWatcher) {
153
+ if (this.autoNotifyWatcher) {
152
154
  // error intentionally ignored
153
155
  if (this.watcherEx) {
154
156
  this.watcherEx.updateForRemovePolicy(sec, ptype, ...rule);
@@ -187,7 +189,7 @@ class InternalEnforcer extends coreEnforcer_1.CoreEnforcer {
187
189
  }
188
190
  }
189
191
  if (useWatcher) {
190
- if (this.watcher && this.autoNotifyWatcher) {
192
+ if (this.autoNotifyWatcher) {
191
193
  // error intentionally ignored
192
194
  if (this.watcherEx) {
193
195
  this.watcherEx.updateForRemovePolicies(sec, ptype, ...rules);
@@ -218,7 +220,7 @@ class InternalEnforcer extends coreEnforcer_1.CoreEnforcer {
218
220
  }
219
221
  }
220
222
  if (useWatcher) {
221
- if (this.watcher && this.autoNotifyWatcher) {
223
+ if (this.autoNotifyWatcher) {
222
224
  // error intentionally ignored
223
225
  if (this.watcherEx) {
224
226
  this.watcherEx.updateForRemoveFilteredPolicy(sec, ptype, fieldIndex, ...fieldValues);
@@ -114,10 +114,12 @@ export class InternalEnforcer extends CoreEnforcer {
114
114
  }
115
115
  }
116
116
  if (useWatcher) {
117
- if (this.watcher && this.autoNotifyWatcher) {
117
+ if (this.autoNotifyWatcher) {
118
118
  // In fact I think it should wait for the respond, but they implement add_policy() like this
119
119
  // error intentionally ignored
120
- this.watcher.update();
120
+ if (this.watcher) {
121
+ this.watcher.update();
122
+ }
121
123
  }
122
124
  }
123
125
  const ok = this.model.updatePolicy(sec, ptype, oldRule, newRule);
@@ -145,7 +147,7 @@ export class InternalEnforcer extends CoreEnforcer {
145
147
  }
146
148
  }
147
149
  if (useWatcher) {
148
- if (this.watcher && this.autoNotifyWatcher) {
150
+ if (this.autoNotifyWatcher) {
149
151
  // error intentionally ignored
150
152
  if (this.watcherEx) {
151
153
  this.watcherEx.updateForRemovePolicy(sec, ptype, ...rule);
@@ -184,7 +186,7 @@ export class InternalEnforcer extends CoreEnforcer {
184
186
  }
185
187
  }
186
188
  if (useWatcher) {
187
- if (this.watcher && this.autoNotifyWatcher) {
189
+ if (this.autoNotifyWatcher) {
188
190
  // error intentionally ignored
189
191
  if (this.watcherEx) {
190
192
  this.watcherEx.updateForRemovePolicies(sec, ptype, ...rules);
@@ -215,7 +217,7 @@ export class InternalEnforcer extends CoreEnforcer {
215
217
  }
216
218
  }
217
219
  if (useWatcher) {
218
- if (this.watcher && this.autoNotifyWatcher) {
220
+ if (this.autoNotifyWatcher) {
219
221
  // error intentionally ignored
220
222
  if (this.watcherEx) {
221
223
  this.watcherEx.updateForRemoveFilteredPolicy(sec, ptype, fieldIndex, ...fieldValues);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "casbin",
3
- "version": "5.27.1",
3
+ "version": "5.29.0",
4
4
  "description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS",
5
5
  "main": "lib/cjs/index.js",
6
6
  "typings": "lib/cjs/index.d.ts",