hapi-rbac
Version:
Rule Based Access Control for Hapijs
19 lines (13 loc) • 349 B
JavaScript
;
const Hoek = require('hoek');
exports = module.exports = (source, key, context, callback) => {
if(!context) {
// Return nothing
return callback();
}
// Check allowed keys
if(['method', 'path'].indexOf(key) === -1) {
return callback();
}
callback(null, Hoek.reach(context, key));
};