Have ideas to improve npm?Join in the discussion! »

nsec-canable

0.1.3 • Public • Published

nsec-canable

NPM version NPM downloads Build Status Coverage Status

An access control library for node.js

Install

$ npm install --save canable

Usage

const Canable = require('canable');
 
const canable = new Canable();
 
class User {}
class Product {}
 
canable.allow(User, 'view', Product);
 
const user = new User();
const product = new Product();
 
canable.can(user, 'view', product).then(console.log);
//=> true
 
canable.can(user, 'edit', product).then(console.log);
//=> false

License

MIT © Yuan Tao

Install

npm i nsec-canable

DownloadsWeekly Downloads

1

Version

0.1.3

License

MIT

Last publish

Collaborators

  • avatar