E
E
Egor Sh2016-04-17 20:27:08
Database
Egor Sh, 2016-04-17 20:27:08

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

1 answer(s)
T
trevoga_su, 2016-04-17
. @EgorkZe

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 question

Ask a Question

731 491 924 answers to any question