user-center-acl
v0.0.3
Published
user-center 权限判断中间件
Downloads
2
Readme
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 ...
}