node.js - what is the best way to integrate node_acl with sails -
node.js - what is the best way to integrate node_acl with sails -
i'd utilize https://github.com/optimalbits/node_acl module http://sailsjs.org framework. configured sails utilize mongodb : in /config/connection.js
mongodb: { adapter: 'sails-mongo', host: 'localhost', port: 27017, user: '', password: '', database: 'acl' }
and in /config/models.js
{ connection: 'mongodb', migrate: 'safe' }
now have configure acl module, in /api/controllers/aclcontroller.js have :
var acl = require('acl'); acl = new acl(new acl.mongodbbackend(dbinstance, 'acl_')); module.exports = { adduserroles : function(req, res) { acl.adduserroles('joed', 'guest', function(err,data){ homecoming res.json({err:err, data:data}); }); }
now how can value of dbinstance instanciate acl?
note : installed acl , sails-mongo dependencies... give thanks help
node_acl seems depend on mongodb driver, have different methods waterline orm sails using.
that said, should able create 2 connections mongo instance, 1 via node_acl library , waterline/sails. long sails models correctly defined should able live side side. if want can prefix node_acl tables, , ignore them in sails.
node.js mongodb sails.js sails-mongo
Comments
Post a Comment