Comparing version 5.16.0 to 5.17.0
@@ -0,1 +1,8 @@ | ||
# [5.17.0](https://github.com/casbin/node-casbin/compare/v5.16.0...v5.17.0) (2022-08-18) | ||
### Features | ||
* add WatcherEx ([#381](https://github.com/casbin/node-casbin/issues/381)) ([10d7086](https://github.com/casbin/node-casbin/commit/10d7086c810ff18d9a3c792a3ec1173744bceeef)) | ||
# [5.16.0](https://github.com/casbin/node-casbin/compare/v5.15.2...v5.16.0) (2022-08-11) | ||
@@ -2,0 +9,0 @@ |
import { Effector } from './effect'; | ||
import { FunctionMap, Model, PolicyOp } from './model'; | ||
import { Adapter, FilteredAdapter, Watcher, BatchAdapter, UpdatableAdapter } from './persist'; | ||
import { Adapter, FilteredAdapter, Watcher, BatchAdapter, UpdatableAdapter, WatcherEx } from './persist'; | ||
import { RoleManager } from './rbac'; | ||
@@ -17,2 +17,3 @@ import { MatchingFunc } from './rbac'; | ||
protected watcher: Watcher | null; | ||
protected watcherEx: WatcherEx | null; | ||
protected rmMap: Map<string, RoleManager>; | ||
@@ -61,2 +62,8 @@ protected enabled: boolean; | ||
/** | ||
* setWatcherEx sets the current watcherEx. | ||
* | ||
* @param watcherEx the watcherEx. | ||
*/ | ||
setWatcherEx(watcherEx: WatcherEx): void; | ||
/** | ||
* setRoleManager sets the current role manager. | ||
@@ -63,0 +70,0 @@ * |
@@ -32,2 +32,3 @@ "use strict"; | ||
this.watcher = null; | ||
this.watcherEx = null; | ||
this.enabled = true; | ||
@@ -101,2 +102,10 @@ this.autoSave = true; | ||
/** | ||
* setWatcherEx sets the current watcherEx. | ||
* | ||
* @param watcherEx the watcherEx. | ||
*/ | ||
setWatcherEx(watcherEx) { | ||
this.watcherEx = watcherEx; | ||
} | ||
/** | ||
* setRoleManager sets the current role manager. | ||
@@ -220,3 +229,6 @@ * | ||
} | ||
if (this.watcher) { | ||
if (this.watcherEx) { | ||
return await this.watcherEx.updateForSavePolicy(this.model); | ||
} | ||
else if (this.watcher) { | ||
return await this.watcher.update(); | ||
@@ -223,0 +235,0 @@ } |
@@ -40,5 +40,8 @@ "use strict"; | ||
} | ||
if (this.watcher && this.autoNotifyWatcher) { | ||
if (this.autoNotifyWatcher) { | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForAddPolicy(sec, ptype, ...rule); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -74,5 +77,8 @@ const ok = this.model.addPolicy(sec, ptype, rule); | ||
} | ||
if (this.watcher && this.autoNotifyWatcher) { | ||
if (this.autoNotifyWatcher) { | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForAddPolicies(sec, ptype, ...rules); | ||
else if (this.watcher) | ||
this.watcher.update(); | ||
} | ||
@@ -138,3 +144,6 @@ const [ok, effects] = await this.model.addPolicies(sec, ptype, rules); | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForRemovePolicy(sec, ptype, ...rule); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -171,3 +180,6 @@ const ok = await this.model.removePolicy(sec, ptype, rule); | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForRemovePolicies(sec, ptype, ...rules); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -196,3 +208,6 @@ const [ok, effects] = this.model.removePolicies(sec, ptype, rules); | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForRemoveFilteredPolicy(sec, ptype, fieldIndex, ...fieldValues); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -199,0 +214,0 @@ const [ok, effects] = this.model.removeFilteredPolicy(sec, ptype, fieldIndex, ...fieldValues); |
@@ -6,2 +6,3 @@ export * from './adapter'; | ||
export * from './watcher'; | ||
export * from './watcherEx'; | ||
export * from './filteredAdapter'; | ||
@@ -8,0 +9,0 @@ export * from './defaultFilteredAdapter'; |
@@ -18,2 +18,3 @@ "use strict"; | ||
__exportStar(require("./watcher"), exports); | ||
__exportStar(require("./watcherEx"), exports); | ||
__exportStar(require("./filteredAdapter"), exports); | ||
@@ -20,0 +21,0 @@ __exportStar(require("./defaultFilteredAdapter"), exports); |
import { Effector } from './effect'; | ||
import { FunctionMap, Model, PolicyOp } from './model'; | ||
import { Adapter, FilteredAdapter, Watcher, BatchAdapter, UpdatableAdapter } from './persist'; | ||
import { Adapter, FilteredAdapter, Watcher, BatchAdapter, UpdatableAdapter, WatcherEx } from './persist'; | ||
import { RoleManager } from './rbac'; | ||
@@ -17,2 +17,3 @@ import { MatchingFunc } from './rbac'; | ||
protected watcher: Watcher | null; | ||
protected watcherEx: WatcherEx | null; | ||
protected rmMap: Map<string, RoleManager>; | ||
@@ -61,2 +62,8 @@ protected enabled: boolean; | ||
/** | ||
* setWatcherEx sets the current watcherEx. | ||
* | ||
* @param watcherEx the watcherEx. | ||
*/ | ||
setWatcherEx(watcherEx: WatcherEx): void; | ||
/** | ||
* setRoleManager sets the current role manager. | ||
@@ -63,0 +70,0 @@ * |
@@ -29,2 +29,3 @@ // Copyright 2018 The Casbin Authors. All Rights Reserved. | ||
this.watcher = null; | ||
this.watcherEx = null; | ||
this.enabled = true; | ||
@@ -98,2 +99,10 @@ this.autoSave = true; | ||
/** | ||
* setWatcherEx sets the current watcherEx. | ||
* | ||
* @param watcherEx the watcherEx. | ||
*/ | ||
setWatcherEx(watcherEx) { | ||
this.watcherEx = watcherEx; | ||
} | ||
/** | ||
* setRoleManager sets the current role manager. | ||
@@ -217,3 +226,6 @@ * | ||
} | ||
if (this.watcher) { | ||
if (this.watcherEx) { | ||
return await this.watcherEx.updateForSavePolicy(this.model); | ||
} | ||
else if (this.watcher) { | ||
return await this.watcher.update(); | ||
@@ -220,0 +232,0 @@ } |
@@ -37,5 +37,8 @@ // Copyright 2018 The Casbin Authors. All Rights Reserved. | ||
} | ||
if (this.watcher && this.autoNotifyWatcher) { | ||
if (this.autoNotifyWatcher) { | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForAddPolicy(sec, ptype, ...rule); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -71,5 +74,8 @@ const ok = this.model.addPolicy(sec, ptype, rule); | ||
} | ||
if (this.watcher && this.autoNotifyWatcher) { | ||
if (this.autoNotifyWatcher) { | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForAddPolicies(sec, ptype, ...rules); | ||
else if (this.watcher) | ||
this.watcher.update(); | ||
} | ||
@@ -135,3 +141,6 @@ const [ok, effects] = await this.model.addPolicies(sec, ptype, rules); | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForRemovePolicy(sec, ptype, ...rule); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -168,3 +177,6 @@ const ok = await this.model.removePolicy(sec, ptype, rule); | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForRemovePolicies(sec, ptype, ...rules); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -193,3 +205,6 @@ const [ok, effects] = this.model.removePolicies(sec, ptype, rules); | ||
// error intentionally ignored | ||
this.watcher.update(); | ||
if (this.watcherEx) | ||
await this.watcherEx.updateForRemoveFilteredPolicy(sec, ptype, fieldIndex, ...fieldValues); | ||
else if (this.watcher) | ||
await this.watcher.update(); | ||
} | ||
@@ -196,0 +211,0 @@ const [ok, effects] = this.model.removeFilteredPolicy(sec, ptype, fieldIndex, ...fieldValues); |
@@ -6,2 +6,3 @@ export * from './adapter'; | ||
export * from './watcher'; | ||
export * from './watcherEx'; | ||
export * from './filteredAdapter'; | ||
@@ -8,0 +9,0 @@ export * from './defaultFilteredAdapter'; |
@@ -6,2 +6,3 @@ export * from './adapter'; | ||
export * from './watcher'; | ||
export * from './watcherEx'; | ||
export * from './filteredAdapter'; | ||
@@ -8,0 +9,0 @@ export * from './defaultFilteredAdapter'; |
{ | ||
"name": "casbin", | ||
"version": "5.16.0", | ||
"version": "5.17.0", | ||
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS", | ||
@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
557208
220
13195