mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Only save user permissions if the user is a superadmin
This commit is contained in:
parent
8323ed27c2
commit
429afc6b3f
|
@ -348,8 +348,16 @@ class UsersController extends Controller
|
||||||
$user->company_id = e(Company::getIdForUser($request->input('company_id')));
|
$user->company_id = e(Company::getIdForUser($request->input('company_id')));
|
||||||
$user->manager_id = e($request->input('manager_id'));
|
$user->manager_id = e($request->input('manager_id'));
|
||||||
$user->notes = e($request->input('notes'));
|
$user->notes = e($request->input('notes'));
|
||||||
$user->permissions = json_encode($request->input('permission'));
|
|
||||||
|
|
||||||
|
// Strip out the superuser permission if the user isn't a superadmin
|
||||||
|
$permissions_array = $request->input('permission');
|
||||||
|
|
||||||
|
if (!Auth::user()->isSuperUser()) {
|
||||||
|
unset($permissions_array['superuser']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->permissions = json_encode($permissions_array);
|
||||||
|
|
||||||
if ($user->manager_id == "") {
|
if ($user->manager_id == "") {
|
||||||
$user->manager_id = null;
|
$user->manager_id = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue