News for hackers. Stuff that matters.
Re:Permission Systems for Enterprise That Scale by bencyoung on Wednesday December 24, 2025 @06:14AM (#46374566)
If you're using Postgres then using the ltree module is great for permission systems. Available in RDS too
Re:Permission Systems for Enterprise That Scale by casper14 on Wednesday December 24, 2025 @08:04AM (#46375228)
Could you explain why this is great over alternatives?
Re:Permission Systems for Enterprise That Scale by nh2 on Wednesday December 24, 2025 @08:54AM (#46375583)
Do you have an article about that?
Re:Permission Systems for Enterprise That Scale by bencyoung on Tuesday January 06, 2026 @05:09AM (#46510600)
Sorry for the delay! It's fairly simple. 1. You have a column on your objects you want secured as an LTREE[] 2. You add a GIST index on that column

The values should be the different hierarchy paths to access the object starting with a "type" e.g departments.root.deptA

When you run a query, depending on how you want to access you use a <@ query. E.g. I'm a user with root access to all depts "col <@ 'departments.root'::ltree" or I'm a user in dept A "col <@ 'departments.root.deptA'::ltree" etc

Re:Permission Systems for Enterprise That Scale by calderwoodra on Wednesday December 24, 2025 @11:00AM (#46376675)
Agreed, specifically for the file structure use-case, we were able to solve this with ltree.
Re:Permission Systems for Enterprise That Scale by amcvitty on Wednesday December 24, 2025 @03:19PM (#46378864)
About to embark on a similar project. Would love to hear any insights you can share!
Re:Permission Systems for Enterprise That Scale by bencyoung on Tuesday January 06, 2026 @05:03AM (#46510573)
Sorry for the delay! It's fairly simple.

1. You have a column on your objects you want secured as an LTREE[] 2. You add a GIST index on that column

The values should be the different hierarchy paths to access the object starting with a "type" e.g departments.root.deptA

When you run a query, depending on how you want to access you use a <@ query. E.g. I'm a user with root access to all depts "col <@ 'departments.root'::ltree" or I'm a user in dept A "col <@ 'departments.root.deptA'::ltree" etc