Socket
Socket
Sign inDemoInstall

accessible

Package Overview
Dependencies
15
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

accessible

``` var controlList = { "/tournaments": { getRole: function getUserRole (req, done){ done(undefined, 'organizer'); }, get: ["admin", "organizer"], put: ["admin", "organizer"], post: ["admin", "organizer"],


Version published
Maintainers
1
0

Weekly downloads

Readme

Source

Accessible Basic Usage:

  var controlList = {
    "/tournaments": {
      getRole: function getUserRole (req, done){
        done(undefined, 'organizer');
      },
      get: ["admin", "organizer"],
      put: ["admin", "organizer"],
      post: ["admin", "organizer"],
      delete: ["admin", "organizer"]
    }
  }
  var middleware = acl(controlList);
  var express = express();
  express.use(middleware);

Example of denying users that re not logged in:

    var controlList = {
      "/tournaments": {
        getRole: function getUserRole (req, callback){
          if(!req.user){
            callback(undefined, false);
          }
          callback(undefined, 'user');
        },
        get: ["admin", "organizer", "user"],
        put: ["admin", "organizer"],
        post: ["admin", "organizer"],
        delete: ["admin", "organizer"]
      }
    }

FAQs

Last updated on 25 Mar 2014

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc