1
我想使用https://github.com/OptimalBits/node_acl模块与http://sailsjs.org框架。所以我配置帆使用MongoDB的是这样的: 在/config/connection.js什么是最好的方式来整合node_acl与风帆
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和帆 - 蒙戈依赖... 谢谢你的帮助