rampart

Authorization module for Node.js.

npm install rampart
3 downloads in the last week
12 downloads in the last month

Rampart Build Status

Authorization module with Connect/Express support

Installation

$ npm install rampart

Usage

Auth = require './auth'
Rampart = require 'rampart'
express = require 'express'

class Ability extends Rampart.Ability
  constructor: (user) ->
    user = user || new User

    if user.role is 'admin'
      @can 'manage', User

    else
      @can 'manage', User, {_id: user.id}

app = express()
app.use Auth.session()
app.use Rampart.express(Ability)

app.get '/', (req, res, next) ->
  res.send 401 unless req.user.isAllowed 'read', User

Tests

$ npm test

Authors Christopher Garvis & Moveline

License

MIT

npm loves you