Socket
Book a DemoInstallSign in
Socket

rampart

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rampart

Authorization module for Node.js.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

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

Keywords

acl

FAQs

Package last updated on 19 Oct 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts