Socket
Socket
Sign inDemoInstall

acl-backend-rethinkdb

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    acl-backend-rethinkdb

RethinkDB backend for acl


Version published
Maintainers
1
Install size
18.3 kB
Created

Readme

Source

acl-backend-rethinkdb

RethinkDB backend for acl that works with both rethinkdb and rethinkdbdash (preferred) drivers

Tested with

  • acl@0.4.9
  • rethinkdbdash@2.3.19
  • rethinkdb@2.3.2

Using rethinkdbdash driver

This driver takes care of creating the connection for the user so usage is more straightforward

var acl = require('acl')
var r = require('rethinkdbdash')()
var RethinkDBBackend = require('acl-backend-rethinkdb')

var options = {
  prefix: 'acl_',
  useSingle: true,
  ensureTable: true
}

acl = new acl(new RethinkDBBackend(r, options))
acl.addUserRoles('john', 'admin', function(err) {
 ...
})

Using rethinkdb driver

Since the official rethinkdb driver requires a connection to be passed to the run method, the connection parameter is required for the backend to function

var acl = require('acl')
var r = require('rethinkdb')
var RethinkDBBackend = require('acl-backend-rethinkdb')

r.connect({}).then(function (connection) {
  var options = {
    prefix: 'acl_',
    useSingle: true,
    ensureTable: true
  }

  acl = new acl(new RethinkDBBackend(r, options, connection))
  acl.addUserRoles('john', 'admin', function(err) {
   ...
  })
})

API

RethinkDBBackend ( rethink, [ options ], [ connection ] )
  • rethink { Object } - RethinkDB instance
  • options { Object }
    • [db="test"] { String } - Database name
    • [prefix="acl_"] { String } - Prefix for table names
    • [table="resources"] { String } - Table name for useSingle
    • [useSingle=false] { Boolean } - Use a single table for storing data when true
    • [ensureTable=false] { Boolean } - Creates a table if it does not exist when true. For performance, this option should only be used in dev. In prod the core tables should be created before calling acl functions
  • [connection] { Object } - Database connection object. Required for rethinkdb driver and not used by rethinkdbdash driver

Keywords

FAQs

Last updated on 28 Jul 2016

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