Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

casbin

Package Overview
Dependencies
Maintainers
2
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

casbin - npm Package Compare versions

Comparing version 5.29.0 to 5.30.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [5.30.0](https://github.com/casbin/node-casbin/compare/v5.29.0...v5.30.0) (2024-04-26)
### Features
* ensure eft and priority are respected in p2, r2, etc ([#475](https://github.com/casbin/node-casbin/issues/475)) ([8ef3deb](https://github.com/casbin/node-casbin/commit/8ef3debae7d8f081629b038d78e3d869c32be7f2)), closes [#474](https://github.com/casbin/node-casbin/issues/474)
# [5.29.0](https://github.com/casbin/node-casbin/compare/v5.28.0...v5.29.0) (2024-04-10)

@@ -2,0 +9,0 @@

24

lib/cjs/coreEnforcer.js

@@ -175,13 +175,15 @@ "use strict";

sortPolicies() {
var _a, _b, _c, _d;
const policy = (_b = (_a = this.model.model.get('p')) === null || _a === void 0 ? void 0 : _a.get('p')) === null || _b === void 0 ? void 0 : _b.policy;
const tokens = (_d = (_c = this.model.model.get('p')) === null || _c === void 0 ? void 0 : _c.get('p')) === null || _d === void 0 ? void 0 : _d.tokens;
if (policy && tokens) {
const priorityIndex = tokens.indexOf('p_priority');
if (priorityIndex !== -1) {
policy.sort((a, b) => {
return parseInt(a[priorityIndex], 10) - parseInt(b[priorityIndex], 10);
});
var _a;
(_a = this.model.model.get('p')) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {
const policy = value.policy;
const tokens = value.tokens;
if (policy && tokens) {
const priorityIndex = tokens.indexOf(`${key}_priority`);
if (priorityIndex !== -1) {
policy.sort((a, b) => {
return parseInt(a[priorityIndex], 10) - parseInt(b[priorityIndex], 10);
});
}
}
}
});
}

@@ -446,3 +448,3 @@ /**

}
const eft = parameters['p_eft'];
const eft = parameters[`${enforceContext.pType}_eft`];
if (eft && eftRes === effect_1.Effect.Allow) {

@@ -449,0 +451,0 @@ if (eft === 'allow') {

@@ -237,3 +237,3 @@ "use strict";

const tokens = ast.tokens;
const priorityIndex = tokens.indexOf('p_priority');
const priorityIndex = tokens.indexOf(`${key}_priority`);
if (priorityIndex !== -1) {

@@ -268,3 +268,3 @@ const priorityRule = rule[priorityIndex];

}
const priorityFlag = ast.tokens.indexOf('p_priority') !== -1;
const priorityFlag = ast.tokens.indexOf(`${ptype}_priority`) !== -1;
if (priorityFlag) {

@@ -291,3 +291,3 @@ rules.forEach((rule) => {

}
const priorityIndex = ast.tokens.indexOf('p_priority');
const priorityIndex = ast.tokens.indexOf(`${ptype}_priority`);
if (priorityIndex !== -1) {

@@ -294,0 +294,0 @@ if (oldRule[priorityIndex] === newRule[priorityIndex]) {

@@ -172,13 +172,15 @@ // Copyright 2018 The Casbin Authors. All Rights Reserved.

sortPolicies() {
var _a, _b, _c, _d;
const policy = (_b = (_a = this.model.model.get('p')) === null || _a === void 0 ? void 0 : _a.get('p')) === null || _b === void 0 ? void 0 : _b.policy;
const tokens = (_d = (_c = this.model.model.get('p')) === null || _c === void 0 ? void 0 : _c.get('p')) === null || _d === void 0 ? void 0 : _d.tokens;
if (policy && tokens) {
const priorityIndex = tokens.indexOf('p_priority');
if (priorityIndex !== -1) {
policy.sort((a, b) => {
return parseInt(a[priorityIndex], 10) - parseInt(b[priorityIndex], 10);
});
var _a;
(_a = this.model.model.get('p')) === null || _a === void 0 ? void 0 : _a.forEach((value, key) => {
const policy = value.policy;
const tokens = value.tokens;
if (policy && tokens) {
const priorityIndex = tokens.indexOf(`${key}_priority`);
if (priorityIndex !== -1) {
policy.sort((a, b) => {
return parseInt(a[priorityIndex], 10) - parseInt(b[priorityIndex], 10);
});
}
}
}
});
}

@@ -443,3 +445,3 @@ /**

}
const eft = parameters['p_eft'];
const eft = parameters[`${enforceContext.pType}_eft`];
if (eft && eftRes === Effect.Allow) {

@@ -446,0 +448,0 @@ if (eft === 'allow') {

@@ -215,3 +215,3 @@ // Copyright 2018 The Casbin Authors. All Rights Reserved.

const tokens = ast.tokens;
const priorityIndex = tokens.indexOf('p_priority');
const priorityIndex = tokens.indexOf(`${key}_priority`);
if (priorityIndex !== -1) {

@@ -246,3 +246,3 @@ const priorityRule = rule[priorityIndex];

}
const priorityFlag = ast.tokens.indexOf('p_priority') !== -1;
const priorityFlag = ast.tokens.indexOf(`${ptype}_priority`) !== -1;
if (priorityFlag) {

@@ -269,3 +269,3 @@ rules.forEach((rule) => {

}
const priorityIndex = ast.tokens.indexOf('p_priority');
const priorityIndex = ast.tokens.indexOf(`${ptype}_priority`);
if (priorityIndex !== -1) {

@@ -272,0 +272,0 @@ if (oldRule[priorityIndex] === newRule[priorityIndex]) {

{
"name": "casbin",
"version": "5.29.0",
"version": "5.30.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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc