We have an object Root, which references many other objects. Which eventually is translated into FKs on the DB level. We came up with an ACL scheme where there's a separate permissions table with the user,resource,access_level. And so we change our logic to look at this table before returning the data to the user.
Problem is, objects that are nested should also have the same permissions. And so there are 2 solutions that I could think of:
- Each nested object is written into permissions. Every time we update Root object, we cascade the changes to all nested ones.
- We add root_idto all relevant tables (even if they are referenced through some other intermediate object). And keep checking permissions using thisroot_id.
Both approaches aren't easy to implement. So I wonder maybe there are other approaches that I'm missing.
