Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Authorization module for Node.js with Connect/Express support.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
LICENSE
README.md
package.json

README.md

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

Something went wrong with that request. Please try again.