{"_id":"@climba03003/fastify-endpoint-rbac","_rev":"2-77de9825ee91605c5d00e17aa96d570b","name":"@climba03003/fastify-endpoint-rbac","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@climba03003/fastify-endpoint-rbac","version":"1.0.0","description":"This plugin used to manage the endpoint role-base access control. It will collect all the specified roles and you can specify how to check the access control globally or per-route.","main":"lib/index.js","types":"lib/index.d.ts","exports":{".":{"import":"./lib/mjs/index.js","require":"./lib/index.js"}},"directories":{"lib":"lib"},"scripts":{"lint":"eslint --ext .ts lib test","lint:fix":"npm run lint -- --fix","build":"rollup -c","build:tsc":"tsc -b","unit":"jest","test":"npm run lint && npm run unit","coverage":"jest --coverage","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/climba03003/fastify-endpoint-rbac.git"},"author":{"name":"KaKa"},"license":"GPL-3.0","dependencies":{"fastify-plugin":"^3.0.0"},"devDependencies":{"@rollup/plugin-typescript":"^8.2.1","@types/jest":"^26.0.23","@typescript-eslint/eslint-plugin":"4","eslint":"7","eslint-config-standard-with-typescript":"^20.0.0","eslint-plugin-import":"2","eslint-plugin-node":"11","eslint-plugin-promise":"5","eslint-plugin-standard":"5","fastify":"^3.15.1","husky":"^6.0.0","jest":"^26.6.3","prettier":"^2.3.0","rollup":"^2.47.0","ts-jest":"^26.5.6","typescript":"^4.2.4"},"husky":{"hooks":{"pre-commit":"npm test","pre-push":"npm test"}},"gitHead":"c936f8deb65576cafd5429534dc910402595a60d","bugs":{"url":"https://github.com/climba03003/fastify-endpoint-rbac/issues"},"homepage":"https://github.com/climba03003/fastify-endpoint-rbac#readme","_id":"@climba03003/fastify-endpoint-rbac@1.0.0","_nodeVersion":"16.1.0","_npmVersion":"7.11.2","dist":{"integrity":"sha512-8Lx25fL3JEn2h0LczpFNGC/wTL5ElEFhrtvA4+UNlDYgUw1Z/RLmXcqb3O2+TMjMDE9AyQARxr/ToHt/AcaImg==","shasum":"0a3c7aa1591f1f91a98bca0259449b402a02bd3e","tarball":"https://registry.npmjs.org/@climba03003/fastify-endpoint-rbac/-/fastify-endpoint-rbac-1.0.0.tgz","fileCount":10,"unpackedSize":43907,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgogSzCRA9TVsSAnZWagAA8+EP+gLIhAZgY5X3Tw54qpdC\nDK5C2jO6D6vkuCp65QjdCEaZ4IPvhwFxNW8D21WILOMi7nFocIE5uYa0GAxT\nRbJ+g4D6hCemKSTIVZCrcJgpIAaqJyyezfoZXQpFYjBLijLeH6G93keeF2iX\nBizfWyb1RhWCO8OOluYsffm1RcptYpjP9IRKYbXb/VIjDEI7b95upED/0KC+\nwZpr/XmWg5/tx61uKSySAuvi+g6gZUZtnH1gr5bHC9VgQoLDWguE7BaUaOhz\nKUtzMj10isizpDjrobSF1pohXQoOSvsJRsQv1zNGyTMj1mB/fCpPrk6ESuY4\ns61qby1d3d+7NRi/Y4HsFW7um3sGY33I3ub9BJOy3v3zpmCgEtWbGWUV3YKH\nWsnbVlBJ5pALz7cruwxIUp54TVTh4B0PasXA5918xwXaMCFIqGdG9mGffwyv\nN1RO0opCXV2dY/54pHAIdbYPM2kqGffoISLl/Okw+t7EM9065VYG1zGOzWKO\n1Rn85UqkuijI/f4ozhZYk2/Hn9YM33FLpF5313mFKYi80wbUhOfkzgyx3Bmd\neacQN8yABUGw2xk3oMDfUM1uAW9Kr9XjUebhsw8BQXYnfg/bc3cm/Kh/yR7P\neXmQB5j5OQD+qA1A2fMvKiYgsuZKELrwFgtf+9PBUKpVuo0FiIJA4rhgdew/\ne21b\r\n=C2sQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFTlTyt6yLetC4EsdPVDa/Bo9K3Lkf5hBqGzDzyBa5bPAiBMVZ1+zwd73St9BC6lhMJ/bTbRMN2M6E8pcfg7BlYo6g=="}]},"_npmUser":{"name":"climba03003","email":"kaka@kakawebsitedemo.com"},"maintainers":[{"name":"climba03003","email":"kaka@kakawebsitedemo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-endpoint-rbac_1.0.0_1621230770906_0.5926951173814963"},"_hasShrinkwrap":false},"1.1.0":{"name":"@climba03003/fastify-endpoint-rbac","version":"1.1.0","description":"This plugin used to manage the endpoint role-base access control. It will collect all the specified roles and you can specify how to check the access control globally or per-route.","main":"lib/index.js","types":"lib/index.d.ts","exports":{".":{"import":"./lib/mjs/index.js","require":"./lib/index.js"}},"directories":{"lib":"lib"},"scripts":{"lint":"eslint --ext .ts lib test","lint:fix":"npm run lint -- --fix","build":"rollup -c","build:tsc":"tsc -b","unit":"jest","test":"npm run lint && npm run unit","coverage":"jest --coverage","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/climba03003/fastify-endpoint-rbac.git"},"author":{"name":"KaKa"},"license":"GPL-3.0","dependencies":{"fastify-plugin":"^3.0.0"},"devDependencies":{"@rollup/plugin-typescript":"^8.2.1","@types/jest":"^26.0.23","@typescript-eslint/eslint-plugin":"4","eslint":"7","eslint-config-standard-with-typescript":"^20.0.0","eslint-plugin-import":"2","eslint-plugin-node":"11","eslint-plugin-promise":"4","fastify":"^3.15.1","husky":"^6.0.0","jest":"^26.6.3","prettier":"^2.3.0","rollup":"^2.47.0","ts-jest":"^26.5.6","typescript":"^4.2.4"},"husky":{"hooks":{"pre-commit":"npm test","pre-push":"npm test"}},"gitHead":"2bbfbf6c48cc622bd1838bb78853c744105110ac","bugs":{"url":"https://github.com/climba03003/fastify-endpoint-rbac/issues"},"homepage":"https://github.com/climba03003/fastify-endpoint-rbac#readme","_id":"@climba03003/fastify-endpoint-rbac@1.1.0","_nodeVersion":"16.1.0","_npmVersion":"7.11.2","dist":{"integrity":"sha512-Ja53BlPYmCYsg3BLUvbRaUt5XHLH6sGT/F93riPOeuZ3L/58GlzN7wdiWN6XFh/9MglkSnGLIoecdLQmDy8U6Q==","shasum":"aa9b9effd4fd1d81f74820cd2dc34fe23dd72139","tarball":"https://registry.npmjs.org/@climba03003/fastify-endpoint-rbac/-/fastify-endpoint-rbac-1.1.0.tgz","fileCount":10,"unpackedSize":44373,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgp23yCRA9TVsSAnZWagAAeNcP/0azzf/yx3juNova/fTH\nsCAdZPYZ2X8mkj6lTnbre+715xMYLcZOXPS/Hb0F2MbqGIVRqAQK5satGdJW\nMEIT+m7n9bJFcu1AjN1e8aP3/2U0+Lhb+3ORgqC7HCQJBXuubf6x5bW0tnBb\nYwDaFQwEDpbu/sAH5MlUPOujprIU1/BBe4EAO8SNENWWwp5qE/o+LNoWTw2g\ntasB6L+YdM7g+GRpUtzy19QImNyHRs5v+uHf9Buu9OrRY0+WEAeB0FI5VzH3\nGoBrrtxPketQtEXeQy2yKXTAfmyAF7Pk/XZP/OEETOVjIpvQ+T4iVgUoTWmN\nJpLOTUfYPeCMpItxH4GZDwTnpnoX3sDNc6F+A/ofjZ/CljNNK4j9h56MHMoH\n6EbhqCR/SR3tzgWsyaWGy8k8rzcm3aFi/0u7W2ZnsjkcFjB9dI14CeE7Yk6A\n0xpPJNcdgZNRCXp1A4B0EjLR1uJ4qZaCkYMWL5uufyOtu5Y2cno7FUX2DTuq\nGM/oZvPBYu1P+8+jEjttdxRUO8K7YcamopTvcIFL5z3nmBKn+pk29zLJHJHR\ntfU0cPlJnzYlLaAQo13uVbwrfc6JpksbjPZAgEOXR1CenuLXhEcZwhrHz+Bu\n8hXVFEmc3Whm5hQzroz5NlSS2Z5dJBIF6Ej2mMu1jw6ifknbIo9Lo7ROsIhd\nyqBz\r\n=4nZ/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCahO1EYmawNm+CDxhOfA1+by4M6Q24mtrfUBoAQ+T3uAIhAPfGechOWyGeHbJfRjy9d998Hr1KpmOXoYknvhYBpzjZ"}]},"_npmUser":{"name":"climba03003","email":"kaka@kakawebsitedemo.com"},"maintainers":[{"name":"climba03003","email":"kaka@kakawebsitedemo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-endpoint-rbac_1.1.0_1621585393942_0.6073624841451655"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-17T05:52:50.849Z","1.0.0":"2021-05-17T05:52:51.016Z","modified":"2022-04-04T23:23:21.209Z","1.1.0":"2021-05-21T08:23:14.096Z"},"maintainers":[{"name":"climba03003","email":"kaka@kakawebsitedemo.com"}],"description":"This plugin used to manage the endpoint role-base access control. It will collect all the specified roles and you can specify how to check the access control globally or per-route.","homepage":"https://github.com/climba03003/fastify-endpoint-rbac#readme","repository":{"type":"git","url":"git+https://github.com/climba03003/fastify-endpoint-rbac.git"},"author":{"name":"KaKa"},"bugs":{"url":"https://github.com/climba03003/fastify-endpoint-rbac/issues"},"license":"GPL-3.0","readme":"# @climba03003/fastify-endpoint-rbac\n\nThis plugin used to manage the endpoint role-base access control. It will collect\nall the specified roles and you can specify how to check the access control globally\nor per-route.\n\n## Install\n```\nnpm install @climba03003/fastify-endpoint-rbac --save\n\nyarn add @climba03003/fastify-endpoint-rbac\n```\n\n## Usage\n\n```ts\nimport FastifyRBAC from '@climba03003/fastify-endpoint-rbac'\n\nfastify.register(FastifyRBAC, {\n  // how to retrieve account roles\n  retrieveAccountRoles(request, reply) {\n    return [] // must return array or promise array\n  },\n  // how to check rbac globally\n  checkRBAC(routeRoles, accountRoles) {\n    return true // must return boolean or promise boolean\n  },\n  // change the error message when return 403\n  forbiddenMessage: 'No Privilege'\n})\n\nfastify.get(\n  '/',\n  {\n    config: {\n      rbac: {\n        // specify roles for this route\n        roles: ['index:read'],\n        // skip rbac check at early stage even if roles is specified\n        skip: false,\n        // route base rbac check\n        checkRBAC(routeRoles, accountRoles) {\n          return true // must return boolean or promise boolean\n        },\n      }\n    }\n  }\n)\n\n```\n\n### Decorators\n\n```ts\n// Map of route and roles\nfastify.rbac.routeRBAC\n// Map {\n//  GET:/ => ['index:read']\n// }\n\n// Array of all roles\nfastify.rbac.roles\n// ['index:read']\n\n```","readmeFilename":"README.md"}