@lifeomic/abac
Advanced tools
Comparing version 3.4.0 to 4.0.0
@@ -180,2 +180,10 @@ 'use strict'; | ||
case 'notEquals': | ||
if (compareValue === undefined) return undefined; | ||
return value !== compareValue; | ||
case 'notIn': | ||
if (compareValue === undefined) return undefined; | ||
return Array.isArray(compareValue) && !compareValue.includes(value); | ||
case 'superset': | ||
@@ -281,4 +289,8 @@ if (compareValue === undefined) return undefined; | ||
const enforce = (operation, policy, attributes) => { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
try { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
} catch (error) { | ||
return false; | ||
} | ||
@@ -308,4 +320,8 @@ // It is safe to ignore the injection attach here because the operation name has been validated | ||
const enforceLenient = (operation, policy, attributes) => { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
try { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
} catch (error) { | ||
return false; | ||
} | ||
@@ -312,0 +328,0 @@ // It is safe to ignore the injection attach here because the operation name has been validated |
@@ -11,3 +11,3 @@ { | ||
"type": "string", | ||
"enum": ["superset", "in"] | ||
"enum": ["superset", "in", "notIn"] | ||
}, | ||
@@ -17,3 +17,3 @@ "value": { | ||
"items" : { | ||
"type": "string" | ||
"type": ["number", "string"] | ||
} | ||
@@ -29,3 +29,3 @@ } | ||
"type": "string", | ||
"enum": ["includes", "equals"] | ||
"enum": ["includes", "equals", "notEquals"] | ||
}, | ||
@@ -43,3 +43,3 @@ "value": { | ||
"type": "string", | ||
"enum": ["superset", "in", "equals", "includes"] | ||
"enum": ["superset", "in", "equals", "includes", "notEquals", "notIn"] | ||
}, | ||
@@ -58,3 +58,3 @@ "target": { | ||
"type": "string", | ||
"not": {"enum": ["superset", "in", "equals", "includes"]} | ||
"not": {"enum": ["superset", "in", "equals", "includes", "notEquals", "notIn"]} | ||
} | ||
@@ -61,0 +61,0 @@ }, |
@@ -213,2 +213,10 @@ 'use strict'; | ||
case 'notEquals': | ||
if (compareValue === undefined) return undefined; | ||
return value !== compareValue; | ||
case 'notIn': | ||
if (compareValue === undefined) return undefined; | ||
return Array.isArray(compareValue) && !compareValue.includes(value); | ||
case 'superset': | ||
@@ -388,4 +396,8 @@ if (compareValue === undefined) return undefined; | ||
var enforce = function enforce(operation, policy, attributes) { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
try { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
} catch (error) { | ||
return false; | ||
} | ||
@@ -415,4 +427,8 @@ // It is safe to ignore the injection attach here because the operation name has been validated | ||
var enforceLenient = function enforceLenient(operation, policy, attributes) { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
try { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
} catch (error) { | ||
return false; | ||
} | ||
@@ -419,0 +435,0 @@ // It is safe to ignore the injection attach here because the operation name has been validated |
@@ -11,3 +11,3 @@ { | ||
"type": "string", | ||
"enum": ["superset", "in"] | ||
"enum": ["superset", "in", "notIn"] | ||
}, | ||
@@ -17,3 +17,3 @@ "value": { | ||
"items" : { | ||
"type": "string" | ||
"type": ["number", "string"] | ||
} | ||
@@ -29,3 +29,3 @@ } | ||
"type": "string", | ||
"enum": ["includes", "equals"] | ||
"enum": ["includes", "equals", "notEquals"] | ||
}, | ||
@@ -43,3 +43,3 @@ "value": { | ||
"type": "string", | ||
"enum": ["superset", "in", "equals", "includes"] | ||
"enum": ["superset", "in", "equals", "includes", "notEquals", "notIn"] | ||
}, | ||
@@ -58,3 +58,3 @@ "target": { | ||
"type": "string", | ||
"not": {"enum": ["superset", "in", "equals", "includes"]} | ||
"not": {"enum": ["superset", "in", "equals", "includes", "notEquals", "notIn"]} | ||
} | ||
@@ -61,0 +61,0 @@ }, |
@@ -156,2 +156,10 @@ 'use strict'; | ||
case 'notEquals': | ||
if (compareValue === undefined) return undefined; | ||
return value !== compareValue; | ||
case 'notIn': | ||
if (compareValue === undefined) return undefined; | ||
return Array.isArray(compareValue) && !compareValue.includes(value); | ||
case 'superset': | ||
@@ -257,4 +265,8 @@ if (compareValue === undefined) return undefined; | ||
const enforce = (operation, policy, attributes) => { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
try { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
} catch (error) { | ||
return false; | ||
} | ||
@@ -284,4 +296,8 @@ // It is safe to ignore the injection attach here because the operation name has been validated | ||
const enforceLenient = (operation, policy, attributes) => { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
try { | ||
// Before using the policy, make sure it's valid | ||
validate(policy); | ||
} catch (error) { | ||
return false; | ||
} | ||
@@ -288,0 +304,0 @@ // It is safe to ignore the injection attach here because the operation name has been validated |
@@ -11,3 +11,3 @@ { | ||
"type": "string", | ||
"enum": ["superset", "in"] | ||
"enum": ["superset", "in", "notIn"] | ||
}, | ||
@@ -17,3 +17,3 @@ "value": { | ||
"items" : { | ||
"type": "string" | ||
"type": ["number", "string"] | ||
} | ||
@@ -29,3 +29,3 @@ } | ||
"type": "string", | ||
"enum": ["includes", "equals"] | ||
"enum": ["includes", "equals", "notEquals"] | ||
}, | ||
@@ -43,3 +43,3 @@ "value": { | ||
"type": "string", | ||
"enum": ["superset", "in", "equals", "includes"] | ||
"enum": ["superset", "in", "equals", "includes", "notEquals", "notIn"] | ||
}, | ||
@@ -58,3 +58,3 @@ "target": { | ||
"type": "string", | ||
"not": {"enum": ["superset", "in", "equals", "includes"]} | ||
"not": {"enum": ["superset", "in", "equals", "includes", "notEquals", "notIn"]} | ||
} | ||
@@ -61,0 +61,0 @@ }, |
{ | ||
"name": "@lifeomic/abac", | ||
"version": "3.4.0", | ||
"version": "4.0.0", | ||
"description": "Lifeomic Attribute Based Access Control Support Module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
140927
1872