@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | // Create the archive and place the version file in it |
| 80 | 80 | $this->zip = Zip::create(config('filesystems.disks.backup.root').DIRECTORY_SEPARATOR.$backupName); |
| 81 | 81 | $this->bar->advance(); |
| 82 | - $this->zip->add(config('filesystems.disks.backup.root') . DIRECTORY_SEPARATOR . 'version.txt'); |
|
| 82 | + $this->zip->add(config('filesystems.disks.backup.root').DIRECTORY_SEPARATOR.'version.txt'); |
|
| 83 | 83 | $this->bar->advance(); |
| 84 | 84 | $this->zip->add(base_path().DIRECTORY_SEPARATOR.'.env'); |
| 85 | 85 | $this->bar->advance(); |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | 'mysqldump tb-dev5-data -u root'); |
| 114 | 114 | $process->run(); |
| 115 | 115 | |
| 116 | - File::put(config('filesystems.disks.backup.root') . DIRECTORY_SEPARATOR . 'database.sql', $process->getOutput()); |
|
| 116 | + File::put(config('filesystems.disks.backup.root').DIRECTORY_SEPARATOR.'database.sql', $process->getOutput()); |
|
| 117 | 117 | $this->bar->advance(); |
| 118 | - $this->zip->add(config('filesystems.disks.backup.root') . DIRECTORY_SEPARATOR . 'database.sql'); |
|
| 118 | + $this->zip->add(config('filesystems.disks.backup.root').DIRECTORY_SEPARATOR.'database.sql'); |
|
| 119 | 119 | $this->bar->advance(); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | $this->line(''); |
| 23 | 23 | // Select which update file to use |
| 24 | 24 | $updateFile = $this->checkForUpdate(); |
| 25 | - if ($updateFile) { |
|
| 25 | + if($updateFile) { |
|
| 26 | 26 | // Open up the file and verify it is at least the same version as the current setup |
| 27 | 27 | $valid = $this->openUpdate($updateFile); |
| 28 | 28 | |
| 29 | - if ($valid) |
|
| 29 | + if($valid) |
|
| 30 | 30 | { |
| 31 | 31 | $this->call('down'); |
| 32 | 32 | $this->copyFiles($updateFile); |
@@ -48,26 +48,26 @@ discard block |
||
| 48 | 48 | $updates = Storage::disk('staging')->files('updates'); |
| 49 | 49 | |
| 50 | 50 | // Cycle through each file in the update directory to see if they are update files |
| 51 | - foreach ($updates as $update) |
|
| 51 | + foreach($updates as $update) |
|
| 52 | 52 | { |
| 53 | 53 | $baseName = explode('/', $update)[1]; |
| 54 | 54 | |
| 55 | 55 | // Verify the file is in the .zip format |
| 56 | 56 | $fileParts = pathinfo($baseName); |
| 57 | - if ($fileParts['extension'] == 'zip') |
|
| 57 | + if($fileParts['extension'] == 'zip') |
|
| 58 | 58 | { |
| 59 | 59 | // Verify this is actually an update file |
| 60 | - $zip = Zip::open(config('filesystems.disks.staging.root') . |
|
| 61 | - DIRECTORY_SEPARATOR . 'updates' . DIRECTORY_SEPARATOR . $baseName); |
|
| 60 | + $zip = Zip::open(config('filesystems.disks.staging.root'). |
|
| 61 | + DIRECTORY_SEPARATOR.'updates'.DIRECTORY_SEPARATOR.$baseName); |
|
| 62 | 62 | $files = $zip->listFiles(); |
| 63 | - if (in_array($fileParts['filename'] . '/config/version.yml', $files)) |
|
| 63 | + if(in_array($fileParts['filename'].'/config/version.yml', $files)) |
|
| 64 | 64 | { |
| 65 | 65 | $updateList[] = $baseName; |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (empty($updateList)) |
|
| 70 | + if(empty($updateList)) |
|
| 71 | 71 | { |
| 72 | 72 | $this->error('No updates have been loaded to the system'); |
| 73 | 73 | $this->error('Please upload update package to the Storage/Staging/Updates folder'); |
@@ -75,15 +75,15 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // Determine if there is more than one update that can be applied |
| 78 | - if (count($updateList) > 1) |
|
| 78 | + if(count($updateList) > 1) |
|
| 79 | 79 | { |
| 80 | 80 | $this->line(''); |
| 81 | 81 | |
| 82 | 82 | $anticipate = []; |
| 83 | - foreach ($updateList as $key => $up) { |
|
| 83 | + foreach($updateList as $key => $up) { |
|
| 84 | 84 | $opt = $key + 1; |
| 85 | 85 | $anticipate[$opt] = $up; |
| 86 | - $this->line('[' . $opt . '] ' . $up); |
|
| 86 | + $this->line('['.$opt.'] '.$up); |
|
| 87 | 87 | } |
| 88 | 88 | $updateFile = $this->choice('Please select which update you would like to load', $anticipate); |
| 89 | 89 | } |
@@ -101,21 +101,21 @@ discard block |
||
| 101 | 101 | $fileParts = pathinfo($file); |
| 102 | 102 | $folder = $fileParts['filename']; |
| 103 | 103 | |
| 104 | - $zip = Zip::open(config('filesystems.disks.staging.root') . |
|
| 105 | - DIRECTORY_SEPARATOR . 'updates' . DIRECTORY_SEPARATOR . $file); |
|
| 104 | + $zip = Zip::open(config('filesystems.disks.staging.root'). |
|
| 105 | + DIRECTORY_SEPARATOR.'updates'.DIRECTORY_SEPARATOR.$file); |
|
| 106 | 106 | |
| 107 | - $zip->extract(config('filesystems.disks.staging.root') . |
|
| 108 | - DIRECTORY_SEPARATOR . 'updates' . DIRECTORY_SEPARATOR . 'tmp'); |
|
| 107 | + $zip->extract(config('filesystems.disks.staging.root'). |
|
| 108 | + DIRECTORY_SEPARATOR.'updates'.DIRECTORY_SEPARATOR.'tmp'); |
|
| 109 | 109 | $zip->close(); |
| 110 | 110 | |
| 111 | - $verFile = fopen(config('filesystems.disks.staging.root') . |
|
| 112 | - DIRECTORY_SEPARATOR . 'updates' . DIRECTORY_SEPARATOR . 'tmp' . |
|
| 113 | - DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . 'config' . |
|
| 114 | - DIRECTORY_SEPARATOR . 'version.yml', 'r'); |
|
| 111 | + $verFile = fopen(config('filesystems.disks.staging.root'). |
|
| 112 | + DIRECTORY_SEPARATOR.'updates'.DIRECTORY_SEPARATOR.'tmp'. |
|
| 113 | + DIRECTORY_SEPARATOR.$folder.DIRECTORY_SEPARATOR.'config'. |
|
| 114 | + DIRECTORY_SEPARATOR.'version.yml', 'r'); |
|
| 115 | 115 | |
| 116 | 116 | $verData = []; |
| 117 | 117 | $i = 0; |
| 118 | - while (!feof( |
|
| 118 | + while(!feof( |
|
| 119 | 119 | /** @scrutinizer ignore-type */ |
| 120 | 120 | $verFile)) |
| 121 | 121 | { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $verFile); |
| 125 | 125 | $data = explode(':', $line); |
| 126 | 126 | |
| 127 | - if (($data[0] === ' major' || $data[0] === ' minor' || $data[0] === ' patch') && $i < 3) |
|
| 127 | + if(($data[0] === ' major' || $data[0] === ' minor' || $data[0] === ' patch') && $i < 3) |
|
| 128 | 128 | { |
| 129 | 129 | $verData[trim($data[0])] = trim($data[1]); |
| 130 | 130 | $i++; |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | $curVersion = new \PragmaRX\Version\Package\Version(); |
| 135 | 135 | |
| 136 | 136 | $valid = false; |
| 137 | - if ($verData['major'] > $curVersion->major()) |
|
| 137 | + if($verData['major'] > $curVersion->major()) |
|
| 138 | 138 | { |
| 139 | 139 | $valid = true; |
| 140 | 140 | } |
| 141 | - else if ($verData['minor'] > $curVersion->minor()) |
|
| 141 | + else if($verData['minor'] > $curVersion->minor()) |
|
| 142 | 142 | { |
| 143 | 143 | $valid = true; |
| 144 | 144 | } |
| 145 | - else if ($verData['patch'] >= $curVersion->patch()) |
|
| 145 | + else if($verData['patch'] >= $curVersion->patch()) |
|
| 146 | 146 | { |
| 147 | 147 | $valid = true; |
| 148 | 148 | } |
@@ -156,24 +156,24 @@ discard block |
||
| 156 | 156 | $fileParts = pathinfo($updateFile); |
| 157 | 157 | $folder = $fileParts['filename']; |
| 158 | 158 | |
| 159 | - $updateFile = config('filesystems.disks.staging.root') . |
|
| 160 | - DIRECTORY_SEPARATOR . 'updates' . DIRECTORY_SEPARATOR . 'tmp' . |
|
| 161 | - DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR; |
|
| 159 | + $updateFile = config('filesystems.disks.staging.root'). |
|
| 160 | + DIRECTORY_SEPARATOR.'updates'.DIRECTORY_SEPARATOR.'tmp'. |
|
| 161 | + DIRECTORY_SEPARATOR.$folder.DIRECTORY_SEPARATOR; |
|
| 162 | 162 | |
| 163 | 163 | // Copy files |
| 164 | - File::copyDirectory($updateFile . 'app', base_path() . DIRECTORY_SEPARATOR . 'app'); |
|
| 165 | - File::copyDirectory($updateFile . 'bootstrap', base_path() . DIRECTORY_SEPARATOR . 'bootstrap'); |
|
| 166 | - File::copyDirectory($updateFile . 'config', base_path() . DIRECTORY_SEPARATOR . 'config'); |
|
| 167 | - File::copyDirectory($updateFile . 'database', base_path() . DIRECTORY_SEPARATOR . 'database'); |
|
| 168 | - File::copyDirectory($updateFile . 'resources', base_path() . DIRECTORY_SEPARATOR . 'resources'); |
|
| 169 | - File::copyDirectory($updateFile . 'routes', base_path() . DIRECTORY_SEPARATOR . 'routes'); |
|
| 164 | + File::copyDirectory($updateFile.'app', base_path().DIRECTORY_SEPARATOR.'app'); |
|
| 165 | + File::copyDirectory($updateFile.'bootstrap', base_path().DIRECTORY_SEPARATOR.'bootstrap'); |
|
| 166 | + File::copyDirectory($updateFile.'config', base_path().DIRECTORY_SEPARATOR.'config'); |
|
| 167 | + File::copyDirectory($updateFile.'database', base_path().DIRECTORY_SEPARATOR.'database'); |
|
| 168 | + File::copyDirectory($updateFile.'resources', base_path().DIRECTORY_SEPARATOR.'resources'); |
|
| 169 | + File::copyDirectory($updateFile.'routes', base_path().DIRECTORY_SEPARATOR.'routes'); |
|
| 170 | 170 | |
| 171 | 171 | // Run Composer Updates |
| 172 | - exec('cd ' . base_path() . ' && composer install --no-dev --no-interaction --optimize-autoloader --no-ansi > /dev/null 2>&1'); |
|
| 172 | + exec('cd '.base_path().' && composer install --no-dev --no-interaction --optimize-autoloader --no-ansi > /dev/null 2>&1'); |
|
| 173 | 173 | $this->call('ziggy:generate'); |
| 174 | 174 | // Run NPM |
| 175 | - exec('cd ' . base_path() . ' && npm install --only=production > /dev/null 2>&1'); |
|
| 176 | - exec('cd ' . base_path() . ' && npm run production > /dev/null 2>&1'); |
|
| 175 | + exec('cd '.base_path().' && npm install --only=production > /dev/null 2>&1'); |
|
| 176 | + exec('cd '.base_path().' && npm run production > /dev/null 2>&1'); |
|
| 177 | 177 | |
| 178 | 178 | // Update the database |
| 179 | 179 | $this->call('migrate', ['--force' => 'default']); |
@@ -22,7 +22,8 @@ discard block |
||
| 22 | 22 | $this->line(''); |
| 23 | 23 | // Select which update file to use |
| 24 | 24 | $updateFile = $this->checkForUpdate(); |
| 25 | - if ($updateFile) { |
|
| 25 | + if ($updateFile) |
|
| 26 | + { |
|
| 26 | 27 | // Open up the file and verify it is at least the same version as the current setup |
| 27 | 28 | $valid = $this->openUpdate($updateFile); |
| 28 | 29 | |
@@ -80,7 +81,8 @@ discard block |
||
| 80 | 81 | $this->line(''); |
| 81 | 82 | |
| 82 | 83 | $anticipate = []; |
| 83 | - foreach ($updateList as $key => $up) { |
|
| 84 | + foreach ($updateList as $key => $up) |
|
| 85 | + { |
|
| 84 | 86 | $opt = $key + 1; |
| 85 | 87 | $anticipate[$opt] = $up; |
| 86 | 88 | $this->line('[' . $opt . '] ' . $up); |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | /** @scrutinizer ignore-type */ |
| 93 | 93 | $this->argument('filename')); |
| 94 | 94 | $this->baseName = $fileParts['filename']; |
| 95 | - $this->archive = Zip::open(config('filesystems.disks.backup.root') . DIRECTORY_SEPARATOR . |
|
| 95 | + $this->archive = Zip::open(config('filesystems.disks.backup.root').DIRECTORY_SEPARATOR. |
|
| 96 | 96 | /** @scrutinizer ignore-type */ |
| 97 | 97 | $this->argument('filename')); |
| 98 | 98 | // if (!$this->archive->has('version.txt')) { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | // Admin landing page |
| 27 | 27 | public function index() |
| 28 | 28 | { |
| 29 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 29 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 30 | 30 | return view('admin.index'); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | ->makeVisible('user_id') |
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 48 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 49 | 49 | Log::debug('User Collection Data:', $userLinks->toArray()); |
| 50 | 50 | return view('admin.userLinks', [ |
| 51 | 51 | 'links' => $userLinks, |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $user = User::find($id); |
| 59 | 59 | |
| 60 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 60 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 61 | 61 | Log::debug('User Link Data:', $user->toArray()); |
| 62 | 62 | return view('admin.linkDetails', [ |
| 63 | 63 | 'user' => $user, |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function passwordPolicy() |
| 69 | 69 | { |
| 70 | 70 | $this->authorize('hasAccess', 'Manage Users'); |
| 71 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 71 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 72 | 72 | return view('admin.userSecurity', [ |
| 73 | 73 | 'passExpire' => config('auth.passwords.settings.expire'), |
| 74 | 74 | ]); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | // Submit the form to change the user password policy |
| 78 | 78 | public function submitPolicy(Request $request) |
| 79 | 79 | { |
| 80 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data:', $request->toArray()); |
|
| 80 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data:', $request->toArray()); |
|
| 81 | 81 | $this->authorize('hasAccess', 'Manage Users'); |
| 82 | 82 | |
| 83 | 83 | $request->validate([ |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | Log::notice('User '.Auth::user()->full_name.' updated User Password Policy'); |
| 92 | 92 | |
| 93 | 93 | // If the setting is changing from never to xx days, update all users |
| 94 | - if ($request->passExpire == 0) { |
|
| 94 | + if($request->passExpire == 0) { |
|
| 95 | 95 | User::whereNotNull('password_expires')->update([ |
| 96 | 96 | 'password_expires' => null |
| 97 | 97 | ]); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function roleSettings() |
| 112 | 112 | { |
| 113 | 113 | $this->authorize('hasAccess', 'Manage User Roles'); |
| 114 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 114 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 115 | 115 | $roles = UserRoleType::with(['UserRolePermissions' => function($query) |
| 116 | 116 | { |
| 117 | 117 | $query->join('user_role_permission_types', 'user_role_permission_types.perm_type_id', '=', 'user_role_permissions.perm_type_id'); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | public function submitRoleSettings(Request $request) |
| 130 | 130 | { |
| 131 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data: ', $request->toArray()); |
|
| 131 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data: ', $request->toArray()); |
|
| 132 | 132 | $this->authorize('hasAccess', 'Manage User Roles'); |
| 133 | 133 | |
| 134 | 134 | $request->validate([ |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | 'name' => $request->name, |
| 167 | 167 | 'description' => $request->description, |
| 168 | 168 | ]); |
| 169 | - foreach ($request->permissions as $perm) |
|
| 169 | + foreach($request->permissions as $perm) |
|
| 170 | 170 | { |
| 171 | 171 | UserRolePermissions::create([ |
| 172 | 172 | 'role_id' => $role->role_id, |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | $userLinks = new UserCollection( |
| 37 | 37 | User::withCount([ |
| 38 | 38 | 'FileLinks', |
| 39 | - 'FileLinks as expired_file_links_count' => function($query) |
|
| 40 | - { |
|
| 39 | + 'FileLinks as expired_file_links_count' => function($query) { |
|
| 41 | 40 | $query->where('expire', '<', Carbon::now()); |
| 42 | 41 | } |
| 43 | 42 | ]) |
@@ -91,7 +90,8 @@ discard block |
||
| 91 | 90 | Log::notice('User '.Auth::user()->full_name.' updated User Password Policy'); |
| 92 | 91 | |
| 93 | 92 | // If the setting is changing from never to xx days, update all users |
| 94 | - if ($request->passExpire == 0) { |
|
| 93 | + if ($request->passExpire == 0) |
|
| 94 | + { |
|
| 95 | 95 | User::whereNotNull('password_expires')->update([ |
| 96 | 96 | 'password_expires' => null |
| 97 | 97 | ]); |
@@ -112,8 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $this->authorize('hasAccess', 'Manage User Roles'); |
| 114 | 114 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
| 115 | - $roles = UserRoleType::with(['UserRolePermissions' => function($query) |
|
| 116 | - { |
|
| 115 | + $roles = UserRoleType::with(['UserRolePermissions' => function($query) { |
|
| 117 | 116 | $query->join('user_role_permission_types', 'user_role_permission_types.perm_type_id', '=', 'user_role_permissions.perm_type_id'); |
| 118 | 117 | }])->get(); |
| 119 | 118 | $perms = UserRolePermissionTypes::all(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function __construct() |
| 26 | 26 | { |
| 27 | 27 | $this->middleware('auth')->except('initializeUser', 'submitInitializeUser'); |
| 28 | - $this->middleware(function ($request, $next) { |
|
| 28 | + $this->middleware(function($request, $next) { |
|
| 29 | 29 | $this->authorize('hasAccess', 'Manage Users'); |
| 30 | 30 | return $next($request); |
| 31 | 31 | }); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $userList = User::with('LastUserLogin')->get()->makeVisible('user_id'); |
| 38 | 38 | $route = 'admin.user.edit'; |
| 39 | 39 | |
| 40 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 40 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 41 | 41 | Log::debug('User list:', $userList->toArray()); |
| 42 | 42 | return view('admin.userIndex', [ |
| 43 | 43 | 'userList' => $userList, |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | // Check if a username is in use |
| 49 | 49 | public function checkUser($username, $type) |
| 50 | 50 | { |
| 51 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data:', ['username' => $username, 'type' => $type]); |
|
| 51 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data:', ['username' => $username, 'type' => $type]); |
|
| 52 | 52 | $user = User::where($type, $username)->first(); |
| 53 | 53 | |
| 54 | 54 | if(!$user) |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 94 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 95 | 95 | Log::debug('Role data: ', $roleArr); |
| 96 | 96 | return view('admin.newUser', [ |
| 97 | 97 | 'roles' => $roleArr |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // Submit the Add User form |
| 102 | 102 | public function store(Request $request) |
| 103 | 103 | { |
| 104 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data:', $request->toArray()); |
|
| 104 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data:', $request->toArray()); |
|
| 105 | 105 | // Validate the new user form |
| 106 | 106 | $request->validate([ |
| 107 | 107 | 'role' => 'required|numeric|exists:user_role_types,role_id', |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | // List all inactive users |
| 146 | 146 | public function show($type) |
| 147 | 147 | { |
| 148 | - $route = ''; |
|
| 148 | + $route = ''; |
|
| 149 | 149 | |
| 150 | 150 | if($type !== 'inactive') |
| 151 | 151 | { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /** @scrutinizer ignore-call */ |
| 156 | 156 | ->makeVisible('user_id')); |
| 157 | 157 | |
| 158 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 158 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 159 | 159 | Log::debug('Inactive User List: ', $userList->toArray()); |
| 160 | 160 | |
| 161 | 161 | return view('admin.userDeleted', [ |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | $roles = UserRoleType::all(); |
| 172 | 172 | $user = new UserResource(User::findOrFail($id)); |
| 173 | 173 | |
| 174 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 174 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 175 | 175 | |
| 176 | 176 | // Make sure that the user is not trying to edit someone with more permissions |
| 177 | - if ($user->role_id < Auth::user()->role_id) |
|
| 177 | + if($user->role_id < Auth::user()->role_id) |
|
| 178 | 178 | { |
| 179 | 179 | Log::notice('User '.Auth::user()->full_name.' tried to update a user that has more permissions than they do. This request was denied.'); |
| 180 | 180 | return abort(403); |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // Good to go - get role information |
| 184 | 184 | $roleArr = []; |
| 185 | - foreach ($roles as $role) { |
|
| 186 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
| 185 | + foreach($roles as $role) { |
|
| 186 | + if($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
| 187 | 187 | continue; |
| 188 | - } else if ($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
| 188 | + } else if($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
| 189 | 189 | continue; |
| 190 | 190 | } else { |
| 191 | 191 | // $roleArr[$role->role_id] = $role->name; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | // Reactivate a disabled user |
| 209 | 209 | public function reactivateUser($id) |
| 210 | 210 | { |
| 211 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 211 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 212 | 212 | User::withTrashed()->where('user_id', $id)->restore(); |
| 213 | 213 | |
| 214 | 214 | Log::info('User ID '.$id.' reactivated by '.Auth::user()->full_name); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // Submit the update user form |
| 221 | 221 | public function update(Request $request, $id) |
| 222 | 222 | { |
| 223 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data:', $request->toArray()); |
|
| 223 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name.'. Submitted Data:', $request->toArray()); |
|
| 224 | 224 | $request->validate([ |
| 225 | 225 | 'username' => [ |
| 226 | 226 | 'required', |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | // Update the user data |
| 239 | 239 | $user = User::findOrFail($id); |
| 240 | 240 | |
| 241 | - if ($user->role_id < Auth::user()->role_id) |
|
| 241 | + if($user->role_id < Auth::user()->role_id) |
|
| 242 | 242 | { |
| 243 | 243 | return abort(403); |
| 244 | 244 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | // Submit the change password form |
| 261 | 261 | public function submitPassword(Request $request) |
| 262 | 262 | { |
| 263 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 263 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 264 | 264 | |
| 265 | 265 | $request->validate([ |
| 266 | 266 | 'password' => 'required|string|min:6|confirmed', |
@@ -279,12 +279,12 @@ discard block |
||
| 279 | 279 | $user = User::find($request->user_id); |
| 280 | 280 | |
| 281 | 281 | // Verify this is a valid user ID |
| 282 | - if (!$user) { |
|
| 282 | + if(!$user) { |
|
| 283 | 283 | $success = false; |
| 284 | 284 | $reason = 'Cannot find user with this ID'; |
| 285 | 285 | } |
| 286 | 286 | // Make sure that the user is not trying to deactivate someone with more permissions |
| 287 | - else if ($user->role_id < Auth::user()->role_id) { |
|
| 287 | + else if($user->role_id < Auth::user()->role_id) { |
|
| 288 | 288 | $success = false; |
| 289 | 289 | $reason = 'You cannot change password for a user with higher permissions that you. If this user has locked themselves out, have then use the reset link on the login page.'; |
| 290 | 290 | } |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | 'password_expires' => $nextChange |
| 298 | 298 | ]); |
| 299 | 299 | $success = true; |
| 300 | - $reason = 'Password for ' . $user->full_name . ' successfully reset.'; |
|
| 300 | + $reason = 'Password for '.$user->full_name.' successfully reset.'; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - Log::notice('User ID-' . $request->user_id . ' password chagned by ' . Auth::user()->Full_name, [ |
|
| 303 | + Log::notice('User ID-'.$request->user_id.' password chagned by '.Auth::user()->Full_name, [ |
|
| 304 | 304 | 'success' => $success, |
| 305 | 305 | 'reason' => $reason, |
| 306 | 306 | ]); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $reason = 'User '.$user->full_name.' successfully deactivated.'; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 346 | + Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 347 | 347 | Log::notice('User ID-'.$id.' disabled by '.Auth::user()->full_name, [ |
| 348 | 348 | 'success' => $success, |
| 349 | 349 | 'reason' => $reason, |
@@ -182,12 +182,18 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // Good to go - get role information |
| 184 | 184 | $roleArr = []; |
| 185 | - foreach ($roles as $role) { |
|
| 186 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
| 185 | + foreach ($roles as $role) |
|
| 186 | + { |
|
| 187 | + if ($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 188 | + { |
|
| 187 | 189 | continue; |
| 188 | - } else if ($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
| 190 | + } |
|
| 191 | + else if ($role->role_id == 2 && Auth::user()->role_id > 1) |
|
| 192 | + { |
|
| 189 | 193 | continue; |
| 190 | - } else { |
|
| 194 | + } |
|
| 195 | + else |
|
| 196 | + { |
|
| 191 | 197 | // $roleArr[$role->role_id] = $role->name; |
| 192 | 198 | $roleArr[] = [ |
| 193 | 199 | 'value' => $role->role_id, |
@@ -279,17 +285,20 @@ discard block |
||
| 279 | 285 | $user = User::find($request->user_id); |
| 280 | 286 | |
| 281 | 287 | // Verify this is a valid user ID |
| 282 | - if (!$user) { |
|
| 288 | + if (!$user) |
|
| 289 | + { |
|
| 283 | 290 | $success = false; |
| 284 | 291 | $reason = 'Cannot find user with this ID'; |
| 285 | 292 | } |
| 286 | 293 | // Make sure that the user is not trying to deactivate someone with more permissions |
| 287 | - else if ($user->role_id < Auth::user()->role_id) { |
|
| 294 | + else if ($user->role_id < Auth::user()->role_id) |
|
| 295 | + { |
|
| 288 | 296 | $success = false; |
| 289 | 297 | $reason = 'You cannot change password for a user with higher permissions that you. If this user has locked themselves out, have then use the reset link on the login page.'; |
| 290 | 298 | } |
| 291 | 299 | // Good to go - update user password |
| 292 | - else { |
|
| 300 | + else |
|
| 301 | + { |
|
| 293 | 302 | // Update the user data |
| 294 | 303 | $user->update( |
| 295 | 304 | [ |