mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
bugfix: updating a user when an admin (not a superuser) would remove any groups from the user. (#5914)
This commit is contained in:
parent
e1c095adca
commit
82194cef8a
|
@ -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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue