A
A
AlexSer2018-03-31 08:14:53
Yii
AlexSer, 2018-03-31 08:14:53

How to organize manual adding of users in Yii2?

Hello! Can you suggest how to organize manual adding of users!
I would like to have such a scheme.
With an empty user table, the first registered user received administrator rights, and then this user could create other users, but the standard registration should already be disabled so that no one can register on their own! Is this real?
Give a link or describe in words!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gavrilov, 2018-03-31
@nsleep

In the registration method, you check for the number of users. If = 0, then you allow to register with admin rights, if more, then you prohibit it. In the admin panel you do the usual crud according to the user model, where your first user (with admin rights) will be able to add/edit/delete other users.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question