How I can implement ABAC in nodejs. I want to give access to user using his location and role. any one have demo for it?
I am refering npm package PolicyLine: npm i policyline
refer link - https://www.npmjs.com/package/policyline
How I can implement ABAC in nodejs. I want to give access to user using his location and role. any one have demo for it?
I am refering npm package PolicyLine: npm i policyline
refer link - https://www.npmjs.com/package/policyline
Even though this question is a bit old, I still want to give some answer for other users, which have the same or similar question in mind.
To answer your initial question: It depends on your requirements and application. If you need to hide or show some fields based on permissions and roles, you should go with ABAC. If you just want to do permissions based on models/entities then a simple ACL would work or even just some predefined roles in a simple domain.
So usually you know what you need. Depending on the application one solution (or library) can be totally fine/overkill and in another it is just enough.
BTW: I also can recommend https://casl.js.org/ which is actively maintained and also offers ABAC (including time based permission checks).