From e23ee7540dcd587a0e7681ba63eae137613b7c21 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 17 Jan 2023 15:45:40 -0800 Subject: [PATCH 01/11] Register the components.files ability --- app/Providers/AuthServiceProvider.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 226e3650b5..41cde07fdc 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -114,6 +114,12 @@ class AuthServiceProvider extends ServiceProvider } }); + Gate::define('components.files', function ($user) { + if ($user->hasAccess('components.files')) { + return true; + } + }); + // Can the user import CSVs? Gate::define('import', function ($user) { if ($user->hasAccess('import')) { From 1fef992fa86410e24ad3af320dfc1b9eb316fe67 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 17 Jan 2023 15:58:11 -0800 Subject: [PATCH 02/11] Allow users with components.files ability to upload files for components --- resources/views/components/view.blade.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/views/components/view.blade.php b/resources/views/components/view.blade.php index 2f6a302087..70bd87948b 100644 --- a/resources/views/components/view.blade.php +++ b/resources/views/components/view.blade.php @@ -80,8 +80,7 @@ @endcan - @can('update', Component::class) - + @can('components.files', $component)
  • {{ trans('button.upload') }} From 6c89f08193b0ec48fa08715b4283dad6de9e1ea0 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 17 Jan 2023 16:59:50 -0800 Subject: [PATCH 03/11] Register the accessories.files ability and allow users with the ability to upload files for accessories --- app/Providers/AuthServiceProvider.php | 6 ++++++ resources/views/accessories/view.blade.php | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 41cde07fdc..f18eb2fd36 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -114,6 +114,12 @@ class AuthServiceProvider extends ServiceProvider } }); + Gate::define('accessories.files', function ($user) { + if ($user->hasAccess('accessories.files')) { + return true; + } + }); + Gate::define('components.files', function ($user) { if ($user->hasAccess('components.files')) { return true; diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 2bccb40a9b..45ffab272d 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -84,8 +84,7 @@
  • @endcan - @can('update', Component::class) - + @can('update', \App\Models\Accessory::class)
  • {{ trans('button.upload') }} From 1f121372456b4d9f533120cce2cd31735942a98b Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 17 Jan 2023 17:09:55 -0800 Subject: [PATCH 04/11] Close divs in correct location --- resources/views/accessories/view.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 45ffab272d..497a53576b 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -265,14 +265,14 @@ + + @endcan - - From 23a1b2d60ae6e536924c0773278b5768c4e0a414 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 17 Jan 2023 17:15:23 -0800 Subject: [PATCH 05/11] Register the consumables.files ability --- app/Providers/AuthServiceProvider.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index f18eb2fd36..f1e817ca16 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -126,6 +126,12 @@ class AuthServiceProvider extends ServiceProvider } }); + Gate::define('consumables.files', function ($user) { + if ($user->hasAccess('consumables.files')) { + return true; + } + }); + // Can the user import CSVs? Gate::define('import', function ($user) { if ($user->hasAccess('import')) { From 5282ca47b3384ba8b0b831652f6101c3d65856f6 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 17 Jan 2023 17:16:50 -0800 Subject: [PATCH 06/11] Allow users with consumables.files ability to upload files for consumables --- resources/views/consumables/view.blade.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/resources/views/consumables/view.blade.php b/resources/views/consumables/view.blade.php index 90d27cff14..11b187e11b 100644 --- a/resources/views/consumables/view.blade.php +++ b/resources/views/consumables/view.blade.php @@ -45,8 +45,7 @@
  • @endcan - @can('update', Consumable::class) - + @can('update', \App\Models\Consumable::class)
  • {{ trans('button.upload') }} @@ -200,7 +199,7 @@
    From b31e0001655e9a3ffa3bb69bcafd5351ecbc26dd Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 18 Jan 2023 12:54:52 -0800 Subject: [PATCH 07/11] Have Info and History tables in accessory show page span entire width of row --- resources/views/accessories/view.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 497a53576b..68af3dcc37 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -98,7 +98,7 @@
    -
    +
    -
    +
    Date: Wed, 18 Jan 2023 12:55:20 -0800 Subject: [PATCH 08/11] Constrain the bottom bar to the content window --- resources/views/accessories/view.blade.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 68af3dcc37..5c81e91db7 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -344,9 +344,6 @@ @endcan - - -
    @@ -386,8 +383,8 @@
    - - + + From 07744ca7bd824567887e2b7887b7a1599f2cf17f Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 18 Jan 2023 13:41:58 -0800 Subject: [PATCH 09/11] Reference the consumable instance instead of the model --- resources/views/consumables/view.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/consumables/view.blade.php b/resources/views/consumables/view.blade.php index 11b187e11b..f7f7364ea6 100644 --- a/resources/views/consumables/view.blade.php +++ b/resources/views/consumables/view.blade.php @@ -45,7 +45,7 @@ @endcan - @can('update', \App\Models\Consumable::class) + @can('update', $consumable)
  • {{ trans('button.upload') }} From e506ed7950b0070ca84c271f8e27f57976e27534 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 18 Jan 2023 13:42:09 -0800 Subject: [PATCH 10/11] Remove extra quote --- resources/views/consumables/view.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/consumables/view.blade.php b/resources/views/consumables/view.blade.php index f7f7364ea6..6bb3dc26be 100644 --- a/resources/views/consumables/view.blade.php +++ b/resources/views/consumables/view.blade.php @@ -259,7 +259,7 @@ {{ trans('general.checkout') }} @else - @endif From c089f6eff245846c7232846a7e6081935e595fdd Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 18 Jan 2023 13:48:01 -0800 Subject: [PATCH 11/11] Reference the accessory instance instead of the model --- resources/views/accessories/view.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 5c81e91db7..82d7c8201a 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -84,7 +84,7 @@
  • @endcan - @can('update', \App\Models\Accessory::class) + @can('update', $accessory)
  • {{ trans('button.upload') }}