X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/2a2cc858f0f95c606f2ad2542f915d3bd761775f..refs/pull/1756/head:/app/Http/Controllers/UserController.php diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 6984fef1e..b55398d2f 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -177,7 +177,7 @@ class UserController extends Controller } // External auth id updates - if ($this->currentUser->can('users-manage') && $request->filled('external_auth_id')) { + if (user()->can('users-manage') && $request->filled('external_auth_id')) { $user->external_auth_id = $request->get('external_auth_id'); } @@ -202,7 +202,7 @@ class UserController extends Controller } $user->save(); - $this->showSuccessNotification( trans('settings.users_edit_success')); + $this->showSuccessNotification(trans('settings.users_edit_success')); $redirectUrl = userCan('users-manage') ? '/settings/users' : ('/settings/users/' . $user->id); return redirect($redirectUrl); @@ -236,17 +236,17 @@ class UserController extends Controller $user = $this->userRepo->getById($id); if ($this->userRepo->isOnlyAdmin($user)) { - $this->showErrorNotification( trans('errors.users_cannot_delete_only_admin')); + $this->showErrorNotification(trans('errors.users_cannot_delete_only_admin')); return redirect($user->getEditUrl()); } if ($user->system_name === 'public') { - $this->showErrorNotification( trans('errors.users_cannot_delete_guest')); + $this->showErrorNotification(trans('errors.users_cannot_delete_guest')); return redirect($user->getEditUrl()); } $this->userRepo->destroy($user); - $this->showSuccessNotification( trans('settings.users_delete_success')); + $this->showSuccessNotification(trans('settings.users_delete_success')); return redirect('/settings/users'); } @@ -261,7 +261,7 @@ class UserController extends Controller $user = $this->userRepo->getById($id); $userActivity = $this->userRepo->getActivity($user); - $recentlyCreated = $this->userRepo->getRecentlyCreated($user, 5, 0); + $recentlyCreated = $this->userRepo->getRecentlyCreated($user, 5); $assetCounts = $this->userRepo->getAssetCounts($user); return view('users.profile', [