0.1.3 • Published 7 years ago

nsec-canable v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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