From 17215431caec61334cd653e030ba3b42c7ef2ca1 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 31 Jan 2022 14:16:56 +0000 Subject: [PATCH] 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 --- app/Auth/User.php | 2 +- app/Config/dompdf.php | 3 +-- app/Config/snappy.php | 5 ++--- resources/lang/en/common.php | 1 + resources/views/settings/index.blade.php | 3 ++- tests/Auth/AuthTest.php | 19 ++++++++++++++++++- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/app/Auth/User.php b/app/Auth/User.php index 540a8d7ab..f969b351f 100644 --- a/app/Auth/User.php +++ b/app/Auth/User.php @@ -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); } diff --git a/app/Config/dompdf.php b/app/Config/dompdf.php index 55260a22a..a8728852c 100644 --- a/app/Config/dompdf.php +++ b/app/Config/dompdf.php @@ -7,9 +7,8 @@ * Configuration should be altered via the `.env` file or environment variables. * Do not edit this file unless you're happy to maintain any changes yourself. */ - $dompdfPaperSizeMap = [ - 'a4' => 'a4', + 'a4' => 'a4', 'letter' => 'letter', ]; diff --git a/app/Config/snappy.php b/app/Config/snappy.php index abdec8832..8ab10a39c 100644 --- a/app/Config/snappy.php +++ b/app/Config/snappy.php @@ -7,9 +7,8 @@ * Configuration should be altered via the `.env` file or environment variables. * Do not edit this file unless you're happy to maintain any changes yourself. */ - $snappyPaperSizeMap = [ - 'a4' => 'A4', + 'a4' => 'A4', 'letter' => 'Letter', ]; @@ -19,7 +18,7 @@ return [ 'binary' => file_exists(base_path('wkhtmltopdf')) ? base_path('wkhtmltopdf') : env('WKHTMLTOPDF', false), 'timeout' => false, 'options' => [ - 'outline' => true, + 'outline' => true, 'page-size' => $snappyPaperSizeMap[env('EXPORT_PAGE_SIZE', 'a4')] ?? 'A4', ], 'env' => [], diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php index 013042134..2f09e53d1 100644 --- a/resources/lang/en/common.php +++ b/resources/lang/en/common.php @@ -75,6 +75,7 @@ return [ 'status_active' => 'Active', 'status_inactive' => 'Inactive', 'never' => 'Never', + 'none' => 'None', // Header 'header_menu_expand' => 'Expand Header Menu', diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php index 5fe5f3685..8b5615658 100644 --- a/resources/views/settings/index.blade.php +++ b/resources/views/settings/index.blade.php @@ -227,10 +227,11 @@