Merge pull request #11675 from snipe/revert-11663-fixes/user_cant_be_deleted_if_has_consumables

Revert "Prevent to delete a user if still has consumables associated to them"
This commit is contained in:
snipe 2022-08-14 13:42:45 -07:00 committed by GitHub
commit 13b6c281df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 10 deletions

View file

@ -441,10 +441,6 @@ class UsersController extends Controller
return response()->json(Helper::formatStandardApiResponse('error', null, 'This user still has '.$user->accessories->count().' accessories associated with them.'));
}
if (($user->consumables) && ($user->consumables->count() > 0)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'This user still has '.$user->consumables->count().' consumables associated with them.'));
}
if (($user->managedLocations()) && ($user->managedLocations()->count() > 0)) {
return response()->json(Helper::formatStandardApiResponse('error', null, 'This user still has '.$user->managedLocations()->count().' locations that they manage.'));
}

View file

@ -348,12 +348,6 @@ class UsersController extends Controller
->with('error', 'This user still has '.$accessoriesCount.' accessories associated with them.');
}
if (($user->consumables()) && (($consumablesCount = $user->consumables()->count())) > 0) {
// Redirect to the user management page
return redirect()->route('users.index')
->with('error', 'This user still has '.$consumablesCount.' consumables associated with them.');
}
if (($user->managedLocations()) && (($managedLocationsCount = $user->managedLocations()->count())) > 0) {
// Redirect to the user management page
return redirect()->route('users.index')