2
I’m developing a system where your user permissions will be based on the RBAC model,
a user could be in several permissions rules that would give or not privileges to the system, when registering a new user the user to be registered would inherit the permissions of the user who is registering, how to prevent the user who is being registered cannot delete a user who is in a hierarchy above his (according to business) or remove this user from rules that influence his hierarchy in the system. For example
João(Usuário)
->Diretoria(Regra)
->cadastrar usuários(Permissão)
->excluir usuários(Permissão)
Fernando(Usuário)
->RH(Regra)
->cadastrar usuários(Permissão)
->excluir usuários(Permissão)
From the point of view of business(Real world) Board of directors this above RH in the hierarchy but in the RBAC model is an abstraction interpreted by the user who created them! how to prevent for example Fernando director John? simply because they both have the same permission(delete users)! a solution would be to write in the program that the user would only delete or modify users of the same rule, but in this case the director the company could not exclude anyone! or it would have to be in all the rules and if it were also could be deleted by another user, another solution would be to register a history for each user stating who is his father(user who created it) and so on in this case I would write in the program that the user can not take privileges from his parents, this would be a way to represent the hierarchy, but it still wouldn’t be perfect because a director could be registered alongside a regular user and this rule wouldn’t apply to him.
there is some model or solution that can be combined with this to give some hierarchy (from the business point of view) the rules, as could be represented in the relational database?