bugfix: updating a user when an admin (not a superuser) would remove any groups from the user. (#5914)

This commit is contained in:
Daniel Meltzer 2018-07-22 02:02:06 -04:00 committed by snipe
parent e1c095adca
commit 82194cef8a

View file

@ -247,9 +247,10 @@ class UsersController extends Controller
} }
} }
} catch (UserNotFoundException $e) {
$error = trans('admin/users/message.user_not_found', compact('id')); } catch (ModelNotFoundException $e) {
return redirect()->route('users.index')->with('error', $error); return redirect()->route('users.index')
->with('error', trans('admin/users/message.user_not_found', compact('id')))
} }
@ -257,8 +258,6 @@ class UsersController extends Controller
if (Auth::user()->isSuperUser()) { if (Auth::user()->isSuperUser()) {
if ($request->has('groups')) { if ($request->has('groups')) {
$user->groups()->sync($request->input('groups')); $user->groups()->sync($request->input('groups'));
} else {
$user->groups()->sync(array());
} }
} }