Comparing version 5.11.3 to 5.11.4
@@ -0,1 +1,8 @@ | ||
## [5.11.4](https://github.com/casbin/node-casbin/compare/v5.11.3...v5.11.4) (2021-08-17) | ||
### Bug Fixes | ||
* **replaceeval:** add third param to replaceEval and only replace eval() w/ matching ruleName ([#316](https://github.com/casbin/node-casbin/issues/316)) ([bd4f5bf](https://github.com/casbin/node-casbin/commit/bd4f5bfb726c56b323d1417dc415deca21d2c170)), closes [#315](https://github.com/casbin/node-casbin/issues/315) [#315](https://github.com/casbin/node-casbin/issues/315) | ||
## [5.11.3](https://github.com/casbin/node-casbin/compare/v5.11.2...v5.11.3) (2021-08-13) | ||
@@ -2,0 +9,0 @@ |
@@ -365,3 +365,3 @@ "use strict"; | ||
const rule = util_1.escapeAssertion(parameters[ruleName]); | ||
expWithRule = util_1.replaceEval(expWithRule, rule); | ||
expWithRule = util_1.replaceEval(expWithRule, ruleName, rule); | ||
} | ||
@@ -368,0 +368,0 @@ else { |
@@ -12,3 +12,3 @@ declare function escapeAssertion(s: string): string; | ||
declare function hasEval(s: string): boolean; | ||
declare function replaceEval(s: string, rule: string): string; | ||
declare function replaceEval(s: string, ruleName: string, rule: string): string; | ||
declare function getEvalValue(s: string): string[]; | ||
@@ -15,0 +15,0 @@ declare function generatorRunSync(iterator: Generator<any>): any; |
@@ -113,4 +113,4 @@ "use strict"; | ||
// replaceEval replace function eval with the value of its parameters | ||
function replaceEval(s, rule) { | ||
return s.replace(evalReg, '(' + rule + ')'); | ||
function replaceEval(s, ruleName, rule) { | ||
return s.replace(`eval(${ruleName})`, '(' + rule + ')'); | ||
} | ||
@@ -117,0 +117,0 @@ exports.replaceEval = replaceEval; |
@@ -362,3 +362,3 @@ // Copyright 2018 The Casbin Authors. All Rights Reserved. | ||
const rule = escapeAssertion(parameters[ruleName]); | ||
expWithRule = replaceEval(expWithRule, rule); | ||
expWithRule = replaceEval(expWithRule, ruleName, rule); | ||
} | ||
@@ -365,0 +365,0 @@ else { |
@@ -12,3 +12,3 @@ declare function escapeAssertion(s: string): string; | ||
declare function hasEval(s: string): boolean; | ||
declare function replaceEval(s: string, rule: string): string; | ||
declare function replaceEval(s: string, ruleName: string, rule: string): string; | ||
declare function getEvalValue(s: string): string[]; | ||
@@ -15,0 +15,0 @@ declare function generatorRunSync(iterator: Generator<any>): any; |
@@ -99,4 +99,4 @@ // Copyright 2017 The casbin Authors. All Rights Reserved. | ||
// replaceEval replace function eval with the value of its parameters | ||
function replaceEval(s, rule) { | ||
return s.replace(evalReg, '(' + rule + ')'); | ||
function replaceEval(s, ruleName, rule) { | ||
return s.replace(`eval(${ruleName})`, '(' + rule + ')'); | ||
} | ||
@@ -103,0 +103,0 @@ // getEvalValue returns the parameters of function eval |
{ | ||
"name": "casbin", | ||
"version": "5.11.3", | ||
"version": "5.11.4", | ||
"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", |
530373