Answer the question
In order to leave comments, you need to log in
How to make the differentiation of roles on the site and safe authorization of the admin?
Good afternoon, please tell me how best to make user authorization with access rights. I see it this way, in the "user" model, make a field - a role in which to write values \u200b\u200bdepending on the role, admin or a regular user or moderator. And when you log in, the code will determine by email whether you are an admin or not. But how to initially set this role for the admin? you need to climb into the database and manually prescribe the value for the role field? I would like to clarify this point with the pros, because it seems to me that my version is too primitive.
Thank you.
Answer the question
In order to leave comments, you need to log in
the simplest: the
user is attached to the role
role - the definition of which system modules are allowed access. either allowed or not
in a specific module check the role of a logged in user for access to the current module of the system
here is an example for understanding - www.adverts.ru/admin demo demo
go to the section "Administrative groups" the
user demo is attached to the demo group, and for the demo group only viewing the list of ads and the list of groups is allowed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question