A tiny ACL toolkit

npm install node-acl
2 downloads in the last day
10 downloads in the last week
21 downloads in the last month

node-acl Build Status

A tiny ACL toolkit for Node.js


First get an instance of node-acl by passing a set of rules to a factory function

{CRUD,acl} = require 'node-acl'
myRules = [
    { role: "public", model : "stories", crudOps : [] }
    { role: "admin", model : "stories", crudOps : [, CRUD.create, CRUD.delete] }
aclInstance = acl(myRules)

Use the instance where ever you need the validation in your code

result = aclInstance.validate({role:"admin", model: "stories", crudOps: [CRUD.create]})
#> result : null
result = aclInstance.validate({role:"public", model: "stories", crudOps: [CRUD.update]})
#> result : failed validation:{"role":"public","model":"stories","crudOps":["update"]}


npm install node-acl
npm loves you