https://github.com/romansky/node-acl
A tiny ACL toolkit for Node.js
https://github.com/romansky/node-acl
Last synced: about 1 month ago
JSON representation
A tiny ACL toolkit for Node.js
- Host: GitHub
- URL: https://github.com/romansky/node-acl
- Owner: romansky
- Created: 2013-01-19T21:55:38.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-01-28T20:56:11.000Z (over 13 years ago)
- Last Synced: 2025-02-10T06:05:42.044Z (over 1 year ago)
- Language: CoffeeScript
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
node-acl [](https://travis-ci.org/romansky/node-acl)
====
A tiny ACL toolkit for Node.js
## Usage
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 : [CRUD.read] }
{ role: "admin", model : "stories", crudOps : [CRUD.read, 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"]}
## Installation
npm install node-acl