diff --git a/app/Http/Controllers/Users/BulkUsersController.php b/app/Http/Controllers/Users/BulkUsersController.php
index d13f904419..e19db62633 100644
--- a/app/Http/Controllers/Users/BulkUsersController.php
+++ b/app/Http/Controllers/Users/BulkUsersController.php
@@ -13,6 +13,7 @@ use App\Models\Group;
use App\Models\LicenseSeat;
use App\Models\ConsumableAssignment;
use App\Models\Consumable;
+use App\Models\Setting;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
@@ -76,6 +77,30 @@ class BulkUsersController extends Controller
}
return redirect()->back()->with('success', trans('admin/users/message.password_resets_sent'));
+ } elseif ($request->input('bulk_actions') == 'print') {
+ $users = User::query()
+ ->with([
+ 'assets.assetlog',
+ 'assets.assignedAssets.assetlog',
+ 'assets.assignedAssets.defaultLoc',
+ 'assets.assignedAssets.location',
+ 'assets.assignedAssets.model.category',
+ 'assets.defaultLoc',
+ 'assets.location',
+ 'assets.model.category',
+ 'accessories.category',
+ 'accessories.manufacturer',
+ 'consumables.assetlog',
+ 'consumables.category',
+ 'consumables.manufacturer',
+ 'licenses.category',
+ ])
+ ->withTrashed()
+ ->findMany($request->input('ids'));
+
+ return view('users.print')
+ ->with('users', $users)
+ ->with('settings', Setting::getSettings());
}
}
diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php
index 1a82a24093..003a8d41e3 100755
--- a/app/Http/Controllers/Users/UsersController.php
+++ b/app/Http/Controllers/Users/UsersController.php
@@ -619,37 +619,6 @@ class UsersController extends Controller
return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id')));
}
- public function printAllThings()
- {
- $this->authorize('view', User::class);
-
- $users = User::query()
- ->with([
- 'assets.assetlog',
- 'assets.assignedAssets.assetlog',
- 'assets.assignedAssets.defaultLoc',
- 'assets.assignedAssets.location',
- 'assets.assignedAssets.model.category',
- 'assets.defaultLoc',
- 'assets.location',
- 'assets.model.category',
- 'accessories.category',
- 'accessories.manufacturer',
- 'consumables.assetlog',
- 'consumables.category',
- 'consumables.manufacturer',
- 'licenses.category',
- ])
- ->withTrashed()
- ->get();
-
- // @todo: more authorization
-
- return view('users.print')
- ->with('users', $users)
- ->with('settings', Setting::getSettings());
- }
-
/**
* Emails user a list of assigned assets
*
diff --git a/resources/views/partials/users-bulk-actions.blade.php b/resources/views/partials/users-bulk-actions.blade.php
index cf22fde03d..a1dbd25476 100644
--- a/resources/views/partials/users-bulk-actions.blade.php
+++ b/resources/views/partials/users-bulk-actions.blade.php
@@ -14,10 +14,11 @@
+
@endcan
@endif
{{ Form::close() }}
-
\ No newline at end of file
+
diff --git a/routes/web/users.php b/routes/web/users.php
index dd93d44982..6ee2eda9f2 100644
--- a/routes/web/users.php
+++ b/routes/web/users.php
@@ -105,10 +105,6 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () {
]
)->name('users.print');
- Route::get('print-all-things', [Users\UsersController::class, 'printAllThings'])
- ->withoutMiddleware([AssetCountForSidebar::class])
- ->name('users.print-all-things');
-
Route::post(
'{userId}/email',
[