i am using ACL module in my express application.At the start of the server i define some roles and their permissions using the acl.allow() function.
But it logs in a error saying undefined rejection type.The error vanishes on giving a callback with error param.But i am not very sure about what is throwing the error and how it should be handled.
My snippet code which i am using is :
var aclmodule = new acl(new acl.mongodbBackend(config.db.URL, "accesscontrol_"));
aclmodule.allow([
{
roles:['rolea'],
allows:[
{resources:['a','b'], permissions:['*']}
]
},
{
roles:['roleb','rolec'],
allows:[
{resources:['a'], permissions:['view']}
]
},
{
roles:['rolec'],
allows:[
{resources:['o'], permissions:['view','edit']}
]
}
]);
});
The error logged in console is :
Unhandled rejection TypeError: undefined is not a function at D:\user\web\myapp-web\node_modules\acl\lib\mongodb-backend.js:119:15
at D:\myapp\web\myapp-web\node_modules\acl\node_modules\async\lib\async.js:607:21 at D:\myapp\web\myapp-web\node_modules\acl\node_modules\async\lib\async. js:246:17 at iterate (D:\myapp\web\myapp-web\node_modules\acl\node_modules\async\l ib\async.js:146:13) at async.eachSeries (D:\myapp\web\myapp-web\node_modules\acl\node_module s\async\lib\async.js:162:9) at _asyncMap (D:\myapp\web\myapp-web\node_modules\acl\node_modules\async \lib\async.js:245:13) at Object.mapSeries (D:\myapp\web\myapp-web\node_modules\acl\node_module s\async\lib\async.js:228:23) at Object.async.series (D:\myapp\web\myapp-web\node_modules\acl\node_mod ules\async\lib\async.js:605:19) at Object.MongoDBBackend.end (D:\myapp\web\myapp-web\node_modules\acl\li b\mongodb-backend.js:35:11) at Object.tryCatcher (D:\myapp\web\myapp-web\node_modules\acl\node_modul es\bluebird\js\main\util.js:26:23) at Object.ret [as endAsync] (eval at (D:\myapp\web\myapp-web \node_modules\acl\node_modules\bluebird\js\main\promisify.js:163:12),