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

mongoose-groups-acl

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-groups-acl

Mongoose Groups ACL

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

mongoose-grops-acl

Usage

var mongoose = require('mongoose');
var acl = require('mongoose-groups-acl');

var ObjectSchema = new mongoose.Schema({ … });
ObjectSchema.plugin(acl.object);

var UserSchema = new mongoose.Schema({ … });
UserSchema.plugin(acl.subject);

Methods

Getting and setting the permissions for a given object:

var user = …;

user.setAccess(object, ['read', 'write', 'delete']);
user.getAccess(object); // => ['read', 'write', 'delete']

We can query for all objects to which a particular subject has access:

Object.withAccess(user, ['read']).exec(function(err, objects) {
    ...
});

Options

Object

We can specify the path in which the ACL will be stored (by default it will be available at _acl):

ObjectSchema.plugin(acl.object, {
    path: '_acl'
});

There is one special key referred to as the public key. If set, the associated permissions will apply to all subjects:

UserSchema.plugin(acl.subject, {
    public: '*'
});

Install

npm install mongoose-groups-acl

Tests

npm test

FAQs

Package last updated on 20 May 2014

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