在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Jackong/koa-acl开源软件地址:https://github.com/Jackong/koa-acl开源编程语言:JavaScript 100.0%开源软件介绍:ACL middleware for koa.Features
DocumentExamplesSetting options.var ACL = require('koa-acl');
var Acl = require('acl');
app.use(
ACL({
//user getter
user: function(ctx) {
return ctx.state.user._id;
},
//backend getter
backend: new Acl.memoryBackend()
})
); Middleware for users or roles.var ACL = require('koa-acl');
route.delete(
'/api/users/:user',
ACL.middleware(2),
function* (next) {
//do something...
}
); MethodsAcl(options)Configure options for Acl. Arguments options.user {Function} user ID getter.
options.backend {Object|Function} backend getter. Acl.middleware(numPathComponents[, userId, actions])Authorizing by user. Arguments numPathComponents {Number} number of components in the url to be considered part of the resource name (defaults to number of components in the full url).
userId {String|Function} user ID (defaults to options.user).
actions {String|Array} lowercase. Testsnpm test Licences |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论