Designing a user permissions system at several levels

I am working on a site that has a database schema such as a tree. From top to bottom I:

  • One company can have many
  • Places in which there may be many
  • Fleets that can have a lot
  • Vehicles

The system of user permissions should be flexible in that someone can get or have limited access at any level of the tree. For example, the person who controls location x will, by default, have full access to all fleets below location x and all vehicles below location x. But I would also have to restrict user access to any node below the x location.

What would be the right way to design a schema for a permission system such as this? Will it be realistic to store every node the user has access to, even if it is redundant? The goal is so that I can easily run queries, for example, to gain access to all locations that the user has access to.

+7
source share
1 answer

You can find some interesting topics on SO. Among them:

Reputation-based permissions

Database Schema for ACL

+4
source

All Articles