Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scull7/privilege-express
An ExpressJS interface for the privilege module.
https://github.com/scull7/privilege-express
Last synced: about 1 month ago
JSON representation
An ExpressJS interface for the privilege module.
- Host: GitHub
- URL: https://github.com/scull7/privilege-express
- Owner: scull7
- License: mit
- Created: 2015-11-10T00:36:28.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-06T07:26:57.000Z (almost 9 years ago)
- Last Synced: 2024-09-14T00:42:38.967Z (2 months ago)
- Language: CoffeeScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/scull7/privilege-express.svg)](https://travis-ci.org/scull7/privilege-express)
[![Coverage Status](https://coveralls.io/repos/scull7/privilege-express/badge.svg?branch=master&service=github)](https://coveralls.io/github/scull7/privilege-express?branch=master)# privilege-express
An ExpressJS interface for the privilege module.## Example Usage
```javascript
var app = require('express')()
var privilege = require('privilege')({
pathMap: {
'/my/test/path': 'my:test:path:list'
'/my/test/path/:id': 'my:test:path:item'
'/my/other/:id': 'my:other:item'
'/my/other': 'my:other:list'
'/my/other/:id/action': 'my:other:item:action'
},
roleMap: {
'root': {
'*': [ 'get', 'post', 'put', 'delete' ] // root can access all
},
'reader': {
'my:test:path:list': [ 'get' ]
'my:test:path:item': [ 'get' ]
'my:other:item': [ 'get' ]
'my:other:list': [ 'get' ]
}
'writer': {
'my:test:path:list': [ 'get' ]
'my:test:path:item': [ 'get', 'post', 'put', 'delete' ]
'my:other:item': [ 'get', 'post', 'put', 'delete' ]
'my:other:item:action': [ 'post' ]
'my:other:list': [ 'get' ]
}
}
});app.use(privilege);
```