Are there any blueprints/best practices for implem...
# orm-help
r
Are there any blueprints/best practices for implementing RBAC/ABAC access authorization on a database level for Prisma (e.g. as part of schema definitions or query interceptors)?
1
o
I haven't tried it yet, but this is the best thing out there for nodejs according to my knowledge: https://casl.js.org/v5/en
y
I don't think theres much you can do beyond adding a
Role
enum or some other role/tag. You can add hooks to prisma with
prisma.$use
if you'd like
Personally I am not sure it's right to mix your DAL with your permission logic, but I'm sure you made your business considerations
in continuation with Omar above me, casl has a prisma plugin
r
@Omar, @Yuval Datner Thank you both, I definitely will look into CASL. I already also have Casbin and node-abac on my radar, but having a Prisma plugin available as for CASL looks interesting.
n
Hey Rainer 👋 Just to add to what Omar and Yuval suggested, you should have a look at cerbos.dev as well, they have a Prisma integration which could be beneficial for you.
👍 1