K
K
kvninbox2018-02-14 13:24:56
Yii
kvninbox, 2018-02-14 13:24:56

PHP Yii2 Framework - Users & Extend User model / extend User model?

Hello everyone,
Question about best practice Yii2 Framework - or how best to do it?
1. there is a web project based on advanced-template , it has 2 types of users:
1.1. admins (admins, managers, modders) - I made a separate SystemUser model for them, attached RBAC to it - everything works - roles, users, CRUD-admin for them - @backend works out.
1.2. Frontend site users : guest, student (regular user), teacher (also normal, but the user type is different, he will have a different personal cab) - I planned to leave such users within the framework of the standard User.php model that comes with the template.
But for ordinary site users, I need to register not by login, but by email + password, add fields like "avatar, about myself and other text fields", add registration confirmation by email and similar standard features
2. So I need a consultation at the level - how to do it right?
2.1. to leave systems of users separately, and to expand User.php handles? as it is not rational, like wasting time on well-known things
2.2. leave system users and put modules for web users that expand them?
here it seems like a couple of popular ones:
https://github.com/yii2mod/yii2-user
https://github.com/dektrium/yii2-user
It seems that most of the functionality is already there. If so, which modules are more popular?
2.3. to take down all nafig on users, to put what that of modules and to store all users in one table? If that, then the question is modulo - which one is better?
2.4. Your own version of the architectural solution, recommendations, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2018-02-14
@BorisKorobkov

1. Why different tables of users depending on the group? It is more correct to store all users in one table + RBAC.
2. I recommend using https://github.com/dektrium/yii2-user
2.1. Add. fields - in the Profile table. By the way, there is already a lot of
2.2. Authorization by email + password and through social networks also works out of the box

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question