Hey Im working on a folder tree and need to be able to limit the visibility of certain folder based on the user and the group they belong to. I already have a database representation of all the folders in the tree and the hierarchy of the folders.
My question now is how to best represent the permissions.
If I have to possibly look up permissions in a separate table for each folder out there, this could get expensive ( I am granting that because of the hierarchy, we can hide all children of a hidden folder node so they can be discounted).
Does anybody have any good models and algorithms that would make this better? I figure unix file systems have been doing it for awhile, so there must be some really good ideas about how to model this problem.
Note that in the model I am dealing with there is no “owner” of the folder. A folder can be visisble to a user on a case by case basis.
I’m using Java and Mysql btw
On a basic level, the best thing to do is go with your first instinct and create a look-up table for the permissions against the unique id of the folder.
Then benchmark.
If it’s too resource-dependent, you could include the permissions as part of the folder representation in your core database.
But get it working first, and then work out if the performance penalties are too high.