Comparing version
@@ -8,2 +8,3 @@ import { TrueCondition } from './TrueCondition'; | ||
import { AndCondition } from "./AndCondition"; | ||
import { StartsWithCondition } from "./StartsWithCondition"; | ||
import { ICondition } from '../core'; | ||
@@ -18,3 +19,4 @@ export declare namespace Conditions { | ||
const OR: OrCondition; | ||
const STARTS_WITH: StartsWithCondition; | ||
} | ||
export declare const conditionEvaluator: (condition: ICondition, context: any) => boolean; |
@@ -10,2 +10,3 @@ "use strict"; | ||
var AndCondition_1 = require("./AndCondition"); | ||
var StartsWithCondition_1 = require("./StartsWithCondition"); | ||
var core_1 = require("../core"); | ||
@@ -21,2 +22,3 @@ var Conditions; | ||
Conditions.OR = new OrCondition_1.OrCondition(); | ||
Conditions.STARTS_WITH = new StartsWithCondition_1.StartsWithCondition(); | ||
})(Conditions = exports.Conditions || (exports.Conditions = {})); | ||
@@ -23,0 +25,0 @@ exports.conditionEvaluator = function (condition, context) { |
@@ -19,3 +19,3 @@ "use strict"; | ||
return Object.keys(args).every(function (key) { | ||
return utils_1.default.type(context[key]) !== 'string' | ||
return utils_1.default.type(context[key]) === 'string' | ||
&& utils_1.default.matchesAnyElement(args[key], function (elm) { | ||
@@ -22,0 +22,0 @@ return context[key].startsWith(elm); |
{ | ||
"name": "role-acl", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Role, Attribute and Condition based Access Control for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -20,2 +20,5 @@ Role, Attribute and conditions based Access Control for Node.js | ||
- Ability to control access on "own" or "any" resources. | ||
- Ability to control access using conditions. | ||
- Supports AND, OR, NOT, EQUALS, NOT_EQUALS, STARTS_WITH, LIST_CONTAINS conditions | ||
- Policies are JSON compatible so can be stored and retrieved from database. | ||
- Fast. (Grants are stored in memory, no database queries.) | ||
@@ -22,0 +25,0 @@ - TypeScript support. |
152743
0.3%3593
0.11%294
1.03%