1
In the business rule of the system I am working on, a user can have more than one profile. Profiles are: administrator, evaluator and responsible.
For example: So-and-so can be an administrator and evaluator at the same time.
My question is how to map it? I’ve had some ideas but I don’t know if it’s the best way to do it.
One idea: Create a column in the database for each profile, for example: is_admin, is_responsible and is_appraiser and go 0 or 1 according to the user profile.
Here is another idea: Have a column in the database, to store only a number that will be generated according to the profile.
Exemplo:
Administrador = 0
Avaliador = 1
Responsável = 2
Administrador + Avaliador = 4
These are ideas I’ve had, but I don’t know the right way to store it.
I believe that the best way is in the user table to have only one column identified which type of profile of the same.
– Thiago Magalhães
What if there is another profile type? Ideally, you should make a second table since the relationship between user and profile
1:N
.– Roberto de Campos
Is there hierarchy between profiles? Will this control permissions? If so, is each group doing unique to it? Or, for example, administrator to do everything by default?
– Woss
@Andersoncarloswoss there is no hierarchy, they are independent even.
– Guilherme Nass
Are these profiles static or dynamic? They could be an enumeration or new profiles could appear at any time?
– Woss
@Andersoncarloswoss They are static, will always be these three types of profiles.
– Guilherme Nass
For a scalable application I would choose the answer of Dherik, and for a more performative and easy to develop application of Anderson.
– Joao Paulo