1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Fixed default registration role display options

- This also allows an admin to choose not to have a default role.
- Also applied latest styleCI fixes.

For #3220
This commit is contained in:
Dan Brown
2022-01-31 14:16:56 +00:00
parent 90c543064b
commit 17215431ca
6 changed files with 25 additions and 8 deletions

View File

@@ -146,7 +146,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*/
public function attachDefaultRole(): void
{
$roleId = setting('registration-role');
$roleId = intval(setting('registration-role'));
if ($roleId && $this->roles()->where('id', '=', $roleId)->count() === 0) {
$this->roles()->attach($roleId);
}