Rank 3: Container
How can I archive the access control algorithm or helper below conditions.
Here below is the scenario.
It should be like this.
User1A, 1B, 1C have Manager UserM1
User2A, 2B have Manager UserM2
User3A has Manager UserM3
UserM1 has Manager UserMM1
UserM2,M3 has Manager UserMM2
UserMM1, UserMM2 has Manager UserMMM
UserMMM can have its Manager as well and so and so.
Note: Recursive relationship of User and User's Manager could be deep up to 10 levels.
Each users will have access to many customers.
So technically, any customers assigned to the any user, the user will be able to see, And, their manager can see those customers too. Ofc, the manager of that manager will be able to see too. And the next level manager is the same.
======= Additional explanation ========
I have 10 clients = I can only view 10 clients
Pogba have 5 clients = He can view 5 clients.
Paul is my manager and he also has 5 clients = He can view 15 clients
Logan is Pual Manager and he also has 10 clients = He can view 25 clients (Me, Paul, and Logan clients)
Henry is Pogba and Logan Manager = He can view 30 clients (25 client from Logan and Logan's staff + 5 clients from Pogba )
so and so.
Thanks