New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-ruler

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ruler

ACL module to control all stuffs

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Ruler - You CAN do more!

Ruler can help you DO more with ACL.

Just call the Judge to decide if the user can access your resource.


var Ruler = require('ruler');
var Power = require('/sample/ability'); // This file is instead the sample folder on this project.

var person = {};
person.roles = ['admin'];

var acl = new Ruler(Power);

//Promise way...
// Promise me, this user is granted!

// the question: Judge, This PERSON can CREATE an USER?
acl.judge(person, 'create', 'user')
  .then(function(access){
    if(access){
      console.log('Yes, this PERSON can CREATE an USER');
    }else{
      console.log('No, this PERSON can\'t CREATE an USER');
    }
  })
  .catch(function(err){

  });

// Callback way...
// When you return, tell me if this user is granted!

acl.judge(person, 'create', 'user', function(err, access){
  if(!err){
    if(access){
      console.log('Yes, this PERSON can CREATE an USER');
    }else{
      console.log('No, this PERSON can\'t CREATE an USER');
    }
  }
});

Keywords

FAQs

Package last updated on 09 Apr 2015

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc