Skip to content

Commit 4a71355

Browse files
authored
Merge pull request #1 from limit-zero/roles-from-model
Allow roles to be set from model
2 parents 64edcf9 + f3c12aa commit 4a71355

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Security/User/CoreUser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public function __construct(Model $model)
4141
$this->password = $model->get('password');
4242
$this->salt = $model->get('salt');
4343
$this->username = $model->get('email');
44-
$this->roles = ['ROLE_ADMIN\USER'];
44+
45+
$roles = $model->get('roles');
46+
$this->roles = is_array($roles) && !empty($roles) ? $roles : ['ROLE_ADMIN\USER'];
4547
}
4648

4749
/**

0 commit comments

Comments
 (0)