我想将https://github.com/OptimalBits/node_acl模块与http://sailsjs.org框架一起使用。所以我将sails配置为像这样使用mongodb:在/config/connection.js
mongodb: {
adapter: 'sails-mongo',
host: 'localhost',
port: 27017,
user: '',
password: '',
database: 'acl'
}
在 /config/models.js
{
connection: 'mongodb',
migrate: 'safe'
}
现在我必须配置 acl 模块,所以在 /api/controllers/AclController.js 我有:
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){
return res.json({err:err, data:data});
});
}
现在如何获取 dbInstance 的值来实例化 acl?
注意:我安装了acl和sails-mongo依赖...谢谢你的帮助