node-acl-v2
npm install @fizz.js/node-acl-v2dependencies into package.json and run yarn install
acl config into config/${env}.json
[json]
{
"acl": {
"prefix": "acl_",
"useSingle": true,
"v2": {
"baseUrl": "",
"filename": "acl.json",
"path": "config",
"defaultRole": "player",
"decodedObjectName": "user",
"roleSearchPath": "user.roles.name",
"rules": [
{
"group": "user",
"permissions": [
{
"resource": "test/*",
"methods": ["POST", "GET", "PUT"],
"action": "allow"
}
]
},
{
"group": "player",
"permissions": [
{
"resource": "error/*",
"methods": ["POST", "GET", "PUT"],
"action": "allow"
}
]
}
]
}
}
}
`
and you can also configure rules into ${path}/${filename} (e.g. path/acl.json) if you specified path and filename into config.
`[json]
[
{
"group": "user",
"permissions": [
{
"resource": "test/*",
"methods": ["POST", "GET", "PUT"],
"action": "allow"
}
]
},
{
"group": "admin",
"permissions": [
{
"resource": "/",
"methods": ["POST", "GET", "PUT"],
"action": "allow"
}
]
}
]
`
test
`[bash]
yarn test
`
coverage
`[bash]
yarn cover
`
build
`[bash]
yarn build
`
docs
`[bash]
yarn docs
``