New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

role-acl

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

role-acl - npm Package Compare versions

Comparing version

to
3.2.1

2

index.js

@@ -1,4 +0,4 @@

var AC = require('./lib').AccessControl;
var AC = require("./lib").AccessControl;
module.exports = AC;
// adding circular ref to allow easy importing in both ES5/6 and TS projects
module.exports.AccessControl = AC;

@@ -235,3 +235,3 @@ import { Access, IAccessInfo, ICondition, Query, IQueryInfo, Permission } from './core';

* role: "user",
* action: "update,
* action: "update",
* resource: "profile"

@@ -238,0 +238,0 @@ * });

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

* role: "user",
* action: "update,
* action: "update",
* resource: "profile"

@@ -297,0 +297,0 @@ * });

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * And condition

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * Equals condition

@@ -6,5 +6,5 @@ import { TrueCondition } from './TrueCondition';

import { ListContainsCondition } from './ListContainsCondition';
import { OrCondition } from "./OrCondition";
import { AndCondition } from "./AndCondition";
import { StartsWithCondition } from "./StartsWithCondition";
import { OrCondition } from './OrCondition';
import { AndCondition } from './AndCondition';
import { StartsWithCondition } from './StartsWithCondition';
import { ICondition } from '../core';

@@ -11,0 +11,0 @@ export declare namespace Conditions {

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * List contains condition

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * Not condition

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * Not equals condition

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * Or condition

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * Starts with condition

@@ -1,2 +0,2 @@

import { IConditionFunction } from "./IConditionFunction";
import { IConditionFunction } from './IConditionFunction';
/**

@@ -3,0 +3,0 @@ * True condition

import { IAccessInfo } from '../core';
import { ICondition } from "./ICondition";
import { ICondition } from './ICondition';
/**

@@ -4,0 +4,0 @@ * Represents the inner `Access` class that helps build an access information

@@ -1,2 +0,2 @@

import { ICondition } from "./ICondition";
import { ICondition } from './ICondition';
/**

@@ -3,0 +3,0 @@ * An interface that defines an access information to be granted or denied.

{
"name": "role-acl",
"version": "3.2.0",
"version": "3.2.1",
"description": "Role, Attribute and Condition based Access Control for Node.js",

@@ -18,3 +18,4 @@ "main": "./index.js",

"build": "rimraf ./lib && mkdirp ./lib && tsc",
"test": "npm run build && node test",
"test": "ts-node ./node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=jasmine.json",
"test:coverage": "./node_modules/istanbul/lib/cli.js cover -e .ts -x \"*.d.ts\" -x \"*.spec.ts\" ts-node node_modules/jasmine/bin/jasmine.js -- JASMINE_CONFIG_PATH=jasmine.json",
"webpack": "webpack"

@@ -53,10 +54,13 @@ },

"devDependencies": {
"@types/jasmine": "^3.3.0",
"@types/matcher": "^1.1.0",
"@types/node": "^9.4.7",
"jasmine": "^3.1.0",
"jasmine-console-reporter": "^2.0.1",
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"rimraf": "^2.6.1",
"typescript": "^2.4.2",
"webpack": "^4.12.0"
"webpack": "^4.12.0",
"istanbul": "^1.1.0-alpha.1",
"jasmine": "^3.3.0",
"ts-node": "^7.0.1",
"typescript": "^3.1.6"
},

@@ -63,0 +67,0 @@ "dependencies": {

@@ -0,1 +1,3 @@

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=73QY55FZWSPRJ)
Role, Attribute and conditions based Access Control for Node.js

@@ -20,5 +22,5 @@

- Ability to filter data (model) instance by allowed attributes.
- 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
- Supports AND, OR, NOT, EQUALS, NOT_EQUALS, STARTS_WITH, LIST_CONTAINS conditions.
- You can define your own condition functions too but please note if you use custom functions instead of standard conditions, you won't be able to save them as json in the DB.
- Policies are JSON compatible so can be stored and retrieved from database.

@@ -288,3 +290,3 @@ - Fast. (Grants are stored in memory, no database queries.)

```js
// grant list fetched from DB (to be converted to a valid grants object, internally)
// grant list fetched from Database (to be converted to a valid grants object, internally)
let grantList = [

@@ -317,2 +319,14 @@ { role: 'admin', resource: 'video', action: 'create', attributes: ['*'] },

console.log(ac.getGrants());
// You can save ac.getGrants() to Database
// Please note: User should be part of your code and wraps calls to User to table/collection.
await User.save({permissions: JSON.stringify(acl.getGrants())});
// Retrieve from DB
const perms = await User.getBydId(userId);
ac.setGrants(JSON.parse(user.permissions));
// if your DB supports storing JSON natively then you can use following code.
await User.save({permissions: acl.getGrants()});
// Retrieve from DB
const perms = await User.getBydId(userId);
ac.setGrants(user.permissions);
```

@@ -404,1 +418,4 @@

[tests]:https://github.com/tensult/role-acl/blob/master/test/ac.spec.js
## Contact us
This product is supported and actively developed by [Tensult](https://wwww/tensult.com). You can contact us at info@tensult.com.

Sorry, the diff of this file is not supported yet