tonic + npm: we-core-acl

node v4.9.1
version: 1.2.1
endpointsharetweet
var ACL = require('we-core-acl'); var acl = new ACL(); var options = { config: { permissions: { 'fly_fast': { 'title': 'Fly super fast' } }, // roles with permissions roles: { administrator: { // administrators can do everything and dont need permissions name: "Administrator" }, bird: { name: 'bird', permissions: [] }, jet: { name: 'jet', permissions: [ 'fly_fast' ] } } } } acl.init(options, function(){ // acl is ready to use if (acl.can('fly_fast', ['bird'])) { console.log('Birds can fly fast, this will not run in this example'); } else { console.log('Birds cant fly fast'); } if (acl.can('fly_fast', ['jet'])) { console.log('Jet can fly fast'); } else { console.log('Jet cant fly fast, this not run in this example'); } if (acl.can('fly_fast', ['jet', 'bird'])) { console.log('Jet bird cant fly fast'); } else { console.log('Jet bird cant fly fast, this not run in this example'); } });
Created from: https://tonicdev.com/npm/we-core-acl
Loading…

no comments

    sign in to comment