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

/nsec-canable/

    Package Sidebar

    Install

    npm i nsec-canable

    Weekly Downloads

    1

    Version

    0.1.3

    License

    MIT

    Last publish

    Collaborators

    • bitt