News for hackers. Stuff that matters.
Re:PostgreSQL Schema Design by tensor on Sunday March 29, 2020 @06:22PM (#22723324)
Yes, but you need to model it in the database. You don't even need to use the built in role system, you can use a user id that you pass into your database session.

Basically, create three tables: user, user_role, role_permission. Each user can have one or more role, and each role has one or more permissions. Permissions could be things like "view_admin_panel" or even granular like "view_project_with_id_5".

Then, you can create a row level security policy that does the right look up in these tables. I've not run this in a production system yet, but did successfully build out a proof of concept that worked. Performance seemed reasonable.

Re:PostgreSQL Schema Design by socceroos on Monday March 30, 2020 @12:19AM (#22725208)
Yep, I made permissions tables per-entity too with simple `CRUD` access a bit like RWX (it was an API). It's definitely fast enough. I was handling ~5000 concurrent users with queries returning in the ns range. To be fair, I skipped RBAC checks if the entity was marked as 'public'.