works, un-reassignable licenses are an issue
This commit is contained in:
parent
ec863df007
commit
09f2739298
1 changed files with 8 additions and 10 deletions
|
@ -186,7 +186,7 @@ class UsersController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->authorize('update', User::class);
|
$this->authorize('update', User::class);
|
||||||
$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($id);
|
$user = User::with(['assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc'])->withTrashed()->find($id);
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
|
|
||||||
|
@ -235,9 +235,15 @@ class UsersController extends Controller
|
||||||
$user = User::with(['assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc'])->withTrashed()->find($id);
|
$user = User::with(['assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc'])->withTrashed()->find($id);
|
||||||
|
|
||||||
// User is valid - continue...
|
// User is valid - continue...
|
||||||
|
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$this->authorize('update', $user);
|
$this->authorize('update', $user);
|
||||||
|
|
||||||
|
if ($request->has('company_id') && $user->allAssignedCount() > 0 && Setting::getSettings()->full_multiple_companies_support) {
|
||||||
|
return back()->with('error', 'this user has assets, check them in first');
|
||||||
|
}
|
||||||
|
|
||||||
// Figure out of this user was an admin before this edit
|
// Figure out of this user was an admin before this edit
|
||||||
$orig_permissions_array = $user->decodePermissions();
|
$orig_permissions_array = $user->decodePermissions();
|
||||||
$orig_superuser = '0';
|
$orig_superuser = '0';
|
||||||
|
@ -264,15 +270,7 @@ class UsersController extends Controller
|
||||||
$user->jobtitle = $request->input('jobtitle', null);
|
$user->jobtitle = $request->input('jobtitle', null);
|
||||||
$user->phone = $request->input('phone');
|
$user->phone = $request->input('phone');
|
||||||
$user->location_id = $request->input('location_id', null);
|
$user->location_id = $request->input('location_id', null);
|
||||||
if ($request->has('company_id')) {
|
|
||||||
if ($user->assets->count() > 0) {
|
|
||||||
//if ($user->assets()->pluck('company_id') != $user->getRawOriginal('company_id')) {
|
|
||||||
{
|
|
||||||
return back()->with('error', 'this user has assets, check them in first');
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$user->company_id = Company::getIdForUser($request->input('company_id', null));
|
$user->company_id = Company::getIdForUser($request->input('company_id', null));
|
||||||
$user->manager_id = $request->input('manager_id', null);
|
$user->manager_id = $request->input('manager_id', null);
|
||||||
$user->notes = $request->input('notes');
|
$user->notes = $request->input('notes');
|
||||||
|
|
Loading…
Add table
Reference in a new issue