@posiwise/common-services 0.1.98 → 0.1.99
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.
|
@@ -1489,8 +1489,10 @@ class PermissionService {
|
|
|
1489
1489
|
return true;
|
|
1490
1490
|
if (expr === 'false')
|
|
1491
1491
|
return false;
|
|
1492
|
+
// Recursively simplify: split on lowest-precedence operator at depth 0
|
|
1493
|
+
// || has lower precedence than && in JS
|
|
1492
1494
|
let depth = 0;
|
|
1493
|
-
for (let i = 0; i
|
|
1495
|
+
for (let i = 0; i <= expr.length - 2; i++) {
|
|
1494
1496
|
const c = expr[i];
|
|
1495
1497
|
if (c === '(')
|
|
1496
1498
|
depth++;
|
|
@@ -1503,7 +1505,7 @@ class PermissionService {
|
|
|
1503
1505
|
}
|
|
1504
1506
|
}
|
|
1505
1507
|
depth = 0;
|
|
1506
|
-
for (let i = 0; i
|
|
1508
|
+
for (let i = 0; i <= expr.length - 2; i++) {
|
|
1507
1509
|
const c = expr[i];
|
|
1508
1510
|
if (c === '(')
|
|
1509
1511
|
depth++;
|
|
@@ -1515,6 +1517,7 @@ class PermissionService {
|
|
|
1515
1517
|
return (this.evaluateBooleanExpression(left) && this.evaluateBooleanExpression(right));
|
|
1516
1518
|
}
|
|
1517
1519
|
}
|
|
1520
|
+
// Strip matching outer parens
|
|
1518
1521
|
if (expr.startsWith('(') && expr.endsWith(')')) {
|
|
1519
1522
|
let d = 0;
|
|
1520
1523
|
for (let j = 1; j < expr.length - 1; j++) {
|
|
@@ -1527,6 +1530,7 @@ class PermissionService {
|
|
|
1527
1530
|
}
|
|
1528
1531
|
return this.evaluateBooleanExpression(expr.substring(1, expr.length - 1));
|
|
1529
1532
|
}
|
|
1533
|
+
// Unrecognized token - treat as false for safety
|
|
1530
1534
|
return false;
|
|
1531
1535
|
}
|
|
1532
1536
|
handleNonBooleanPermissions(permission, expr, productKey, permission_key, productSlug) {
|