casbin 5.24.3 → 5.25.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 +14 -0
- package/README.md +1 -1
- package/lib/cjs/util/builtinOperators.js +7 -2
- package/lib/cjs/util/util.js +2 -2
- package/lib/esm/util/builtinOperators.js +7 -2
- package/lib/esm/util/util.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [5.25.0](https://github.com/casbin/node-casbin/compare/v5.24.4...v5.25.0) (2023-03-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* replace picomatch with minimatch ([#440](https://github.com/casbin/node-casbin/issues/440)) ([4e977b3](https://github.com/casbin/node-casbin/commit/4e977b33fdece9b8934693d05a1da9a7f10cfa05))
|
|
7
|
+
|
|
8
|
+
## [5.24.4](https://github.com/casbin/node-casbin/compare/v5.24.3...v5.24.4) (2023-03-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **./src/util/util.ts:** fixed unwanted replacement of .r in evals according to issue [#438](https://github.com/casbin/node-casbin/issues/438) ([#439](https://github.com/casbin/node-casbin/issues/439)) ([39878be](https://github.com/casbin/node-casbin/commit/39878be7e22ff9f18c0898c5828328bc1cc95aba))
|
|
14
|
+
|
|
1
15
|
## [5.24.3](https://github.com/casbin/node-casbin/compare/v5.24.2...v5.24.3) (2023-02-27)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|

|
|
24
24
|
|
|
25
|
-
`node-casbin` is a powerful and efficient open-source access control library for Node.JS projects. It provides support for enforcing authorization based on various [access control models](https
|
|
25
|
+
`node-casbin` is a powerful and efficient open-source access control library for Node.JS projects. It provides support for enforcing authorization based on various [access control models](https://wikipedia.org/wiki/Computer_security_model).
|
|
26
26
|
|
|
27
27
|
## All the languages supported by Casbin:
|
|
28
28
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.globMatch = exports.keyMatch5Func = exports.keyMatch4Func = exports.generateGFunction = exports.generateSyncedGFunction = exports.ipMatchFunc = exports.regexMatchFunc = exports.keyMatch3Func = exports.keyGet2Func = exports.keyMatch2Func = exports.keyGetFunc = exports.keyMatchFunc = void 0;
|
|
17
17
|
const ip_1 = require("./ip");
|
|
18
|
-
const
|
|
18
|
+
const minimatch_1 = require("minimatch");
|
|
19
19
|
// regexMatch determines whether key1 matches the pattern of key2 in regular expression.
|
|
20
20
|
function regexMatch(key1, key2) {
|
|
21
21
|
return new RegExp(key2).test(key1);
|
|
@@ -271,7 +271,12 @@ exports.ipMatchFunc = ipMatchFunc;
|
|
|
271
271
|
* ```
|
|
272
272
|
*/
|
|
273
273
|
function globMatch(string, pattern) {
|
|
274
|
-
|
|
274
|
+
// The minimatch doesn't support the pattern starts with *
|
|
275
|
+
// See https://github.com/isaacs/minimatch/issues/195
|
|
276
|
+
if (pattern[0] === '*' && pattern[1] === '/') {
|
|
277
|
+
pattern = pattern.substring(1);
|
|
278
|
+
}
|
|
279
|
+
return minimatch_1.minimatch(string, pattern);
|
|
275
280
|
}
|
|
276
281
|
exports.globMatch = globMatch;
|
|
277
282
|
// generateGFunction is the factory method of the g(_, _) function.
|
package/lib/cjs/util/util.js
CHANGED
|
@@ -18,8 +18,8 @@ exports.bracketCompatible = exports.customIn = exports.deepCopy = exports.genera
|
|
|
18
18
|
// because the expression evaluation doesn't support such variable names.
|
|
19
19
|
const persist_1 = require("../persist");
|
|
20
20
|
function escapeAssertion(s) {
|
|
21
|
-
s = s.replace(/r\./g, 'r_');
|
|
22
|
-
s = s.replace(/p\./g, 'p_');
|
|
21
|
+
s = s.replace(/(?<!\w)r\./g, 'r_');
|
|
22
|
+
s = s.replace(/(?<!\w)p\./g, 'p_');
|
|
23
23
|
return s;
|
|
24
24
|
}
|
|
25
25
|
exports.escapeAssertion = escapeAssertion;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
import { ip } from './ip';
|
|
15
|
-
import {
|
|
15
|
+
import { minimatch } from 'minimatch';
|
|
16
16
|
// regexMatch determines whether key1 matches the pattern of key2 in regular expression.
|
|
17
17
|
function regexMatch(key1, key2) {
|
|
18
18
|
return new RegExp(key2).test(key1);
|
|
@@ -259,7 +259,12 @@ function ipMatchFunc(...args) {
|
|
|
259
259
|
* ```
|
|
260
260
|
*/
|
|
261
261
|
function globMatch(string, pattern) {
|
|
262
|
-
|
|
262
|
+
// The minimatch doesn't support the pattern starts with *
|
|
263
|
+
// See https://github.com/isaacs/minimatch/issues/195
|
|
264
|
+
if (pattern[0] === '*' && pattern[1] === '/') {
|
|
265
|
+
pattern = pattern.substring(1);
|
|
266
|
+
}
|
|
267
|
+
return minimatch(string, pattern);
|
|
263
268
|
}
|
|
264
269
|
// generateGFunction is the factory method of the g(_, _) function.
|
|
265
270
|
function generateGFunction(rm) {
|
package/lib/esm/util/util.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
// because the expression evaluation doesn't support such variable names.
|
|
16
16
|
import { mustGetDefaultFileSystem } from '../persist';
|
|
17
17
|
function escapeAssertion(s) {
|
|
18
|
-
s = s.replace(/r\./g, 'r_');
|
|
19
|
-
s = s.replace(/p\./g, 'p_');
|
|
18
|
+
s = s.replace(/(?<!\w)r\./g, 'r_');
|
|
19
|
+
s = s.replace(/(?<!\w)p\./g, 'p_');
|
|
20
20
|
return s;
|
|
21
21
|
}
|
|
22
22
|
// removeComments removes the comments starting with # in the text.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "casbin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.25.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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"buffer": "^6.0.3",
|
|
54
54
|
"csv-parse": "^5.3.5",
|
|
55
55
|
"expression-eval": "^5.0.0",
|
|
56
|
-
"
|
|
56
|
+
"minimatch": "^7.4.2"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"lib",
|