The ultimate and most complete extension i made to manage all your connections in one place for Hyper.js.
Gardien – Flexible Access Control List for NodeJS
Gardien is a NodeJS module that allows you to have fine rights management in your NodeJS applications and in your web browser. This module has a system of plugins to choose the type of database that will be used to save users, roles and permissions.
Gardien in action
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
var async = require('async') var Gardien = require('gardien') // Setting Redis Driver var driver = new Gardien.drivers.RedisDriver({ prefix: 'gardien', separator: ':', index: 0, options: {} }) // Setting an Seraphin to get user rules var seraphin = new Gardien.Seraphin( driver, { debug: true }) // Setting an Cherubin to check user's permissions var cherubin = new Gardien.Cherubin( { debug: true }) // Setting user id var userId = 'oothkoo' async.series( [ function (cb) { // Seraphin initialization seraphin.init(function (err) { cb(null) }) }, function (cb) { // Retrieve all user (oothkoo) rules seraphin.getAllUserRules(userId, function (rules) { // Give all rules to our cherubin cherubin.updateRules( rules ) console.log('rules', rules) cb(null) }) } ], function (err, results) { // Check if (oothkoo) is allowed to view humans across his all roles console.log('allowed: ' + cherubin.isAllowed(userId, ['*'], ['human'], ['view']) ) } ) |
Github : https://github.com/oOthkOo/gardien