add role user to generated user & update readme

This commit is contained in:
akosse 2020-01-29 13:48:06 +03:00
parent f647a4905c
commit 6630452a1e
2 changed files with 10 additions and 0 deletions

View File

@ -58,3 +58,9 @@ frontend
vendor/ contains dependent 3rd-party packages
environments/ contains environment-based overrides
```
<p>
Для ролей поднять миграцию <br>
php yii migrate --migrationPath=@yii/rbac/migrations <br>
и выполнить консольный скрипт <br>
php yii rbac/init <br>
</p>

View File

@ -126,6 +126,10 @@ class UserCard extends \common\models\UserCard
$user->save();
$auth = Yii::$app->authManager;
$authorRole = $auth->getRole('user');
$auth->assign($authorRole, $user->id);
$log = "Логин: " . $email . " Пароль: " . $password . " | ";
file_put_contents("log.txt", $log, FILE_APPEND | LOCK_EX);