diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index bd527f7643..89283a7c21 100755 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -34,7 +34,7 @@ class DashboardController extends Controller $counts['license'] = \App\Models\License::assetcount(); $counts['consumable'] = \App\Models\Consumable::count(); $counts['component'] = \App\Models\Component::count(); - $counts['user'] = \App\Models\User::count(); + $counts['user'] = \App\Models\Company::scopeCompanyables(Auth::user())->count(); $counts['grand_total'] = $counts['asset'] + $counts['accessory'] + $counts['license'] + $counts['consumable']; if ((! file_exists(storage_path().'/oauth-private.key')) || (! file_exists(storage_path().'/oauth-public.key'))) { diff --git a/app/Models/Company.php b/app/Models/Company.php index 83b6a0670b..413011b9a7 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -73,6 +73,10 @@ final class Company extends SnipeModel } } + /** + * Scoping table queries, determining if a logged in user is part of a company, and only allows + * that user to see items associated with that company + */ private static function scopeCompanyablesDirectly($query, $column = 'company_id', $table_name = null) { if (Auth::user()) { diff --git a/database/migrations/2022_12_20_171851_fix_nullable_migration_for_settings.php b/database/migrations/2022_12_20_171851_fix_nullable_migration_for_settings.php new file mode 100644 index 0000000000..aaffd88c4e --- /dev/null +++ b/database/migrations/2022_12_20_171851_fix_nullable_migration_for_settings.php @@ -0,0 +1,30 @@ +string('ldap_default_group')->nullable()->default(null)->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // nothing to do here - this is a hotfix + } +} diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 6766159be5..38ffde10a0 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -129,7 +129,10 @@ var tableId = $(this).data('id-table'); for (var i in rowsAfter) { - $(buttonName).after(''); + // Do not select things that were already selected + if($('#'+ tableId + '_checkbox_' + rowsAfter[i].id).length == 0) { + $(buttonName).after(''); + } } });