Canornot?
An authorisation and access control library based on JSON Schema.
Install
Using NPM
npm install canornot --save
Using Yarn
yarn add canornot
Usage
Example ABAC module based on Canornot
const Canornot = ;const datastore = ; // A policy that allows getting your own user details, and editing companies// in your list of company idsconst policySchema = properties: 'user:get': $ref: 'actor#/properties/user_id' 'company:edit': $ref: 'actor#/properties/company_ids' ; { return datastore ; }} module { return actorSchema: policySchema: policySchema ;};
Example use of the above ABAC module
//This is our ABAC module based on Canornotconst abac = ; // Create a check method using the provided details (user_id)const permission = ; // Permission is allowed herepermission ; // Permission is denied here!permission ;
Support
Via GitHub issue tracker
License
MIT (See LICENCE file)