I’m building some app on Express.js and I came across an architectural problem with permissions.
Examples resources:
Organisation
, user
, unit
, resource
Each user
can belong to multiple organisation
, each organisation
can have multiple units
, and each unit
can have multiple resources
.
Assume that every user
can add any number of unit
and resource
. And here comes the problem, because app must check if the resource
being added is actually added to unit
, which belongs to organisation
, that has user
who executes this query…
The structure is exemplary, in the real application it will be much more complex, so approach like "move up to the ladder", can be insufficient.
Do any of you have an idea how to solve this problem in the most efficient way?