0.0.3 • Published 5 years ago
user-center-acl v0.0.3
user-center-acl —— user-center鉴权拓展
Quick Start
install
$ yarn add user-center-auth
usage
// in config.js
{
extension: {
'user-center-acl': {
enable: true,
module: require('user-center-auth'),
config: {
aclUrl: 'your-user-center-acl-path'
}
}
},
}
// in controller
exports.your_controller = async (req, cb) => {
const isAllow = await req.isAllow(req, 'resource', 'operation');
// no auth
if(!isAllow)
return cb('NO_AUTH');
// do something if auth ...
}