diff --git a/app-modules/authorization/src/Filament/Resources/PermissionResource.php b/app-modules/authorization/src/Filament/Resources/PermissionResource.php index aef33c4be..e7284e536 100644 --- a/app-modules/authorization/src/Filament/Resources/PermissionResource.php +++ b/app-modules/authorization/src/Filament/Resources/PermissionResource.php @@ -42,7 +42,6 @@ use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; use Filament\Forms\Components\TextInput; -use App\Filament\Clusters\UserManagement; use App\Filament\Tables\Columns\IdColumn; use AidingApp\Authorization\Models\Permission; use AidingApp\Authorization\Filament\Resources\PermissionResource\Pages\ViewPermission; @@ -53,9 +52,7 @@ class PermissionResource extends Resource { protected static ?string $model = Permission::class; - protected static ?string $navigationIcon = 'heroicon-o-key'; - - protected static ?string $cluster = UserManagement::class; + protected static ?string $navigationGroup = 'People Administration'; protected static ?int $navigationSort = 40; diff --git a/app-modules/authorization/src/Filament/Resources/RoleResource.php b/app-modules/authorization/src/Filament/Resources/RoleResource.php index 2db4c0497..3333274b3 100644 --- a/app-modules/authorization/src/Filament/Resources/RoleResource.php +++ b/app-modules/authorization/src/Filament/Resources/RoleResource.php @@ -38,7 +38,6 @@ use Filament\Resources\Resource; use AidingApp\Authorization\Models\Role; -use App\Filament\Clusters\UserManagement; use Illuminate\Database\Eloquent\Builder; use AidingApp\Authorization\Filament\Resources\RoleResource\Pages\EditRole; use AidingApp\Authorization\Filament\Resources\RoleResource\Pages\ViewRole; @@ -50,9 +49,7 @@ class RoleResource extends Resource { protected static ?string $model = Role::class; - protected static ?string $navigationIcon = 'heroicon-o-shield-check'; - - protected static ?string $cluster = UserManagement::class; + protected static ?string $navigationGroup = 'People Administration'; protected static ?int $navigationSort = 30; diff --git a/app-modules/contact/src/Policies/ContactSourcePolicy.php b/app-modules/contact/src/Policies/ContactSourcePolicy.php index b3c81ae5e..1ed62c6e1 100644 --- a/app-modules/contact/src/Policies/ContactSourcePolicy.php +++ b/app-modules/contact/src/Policies/ContactSourcePolicy.php @@ -55,7 +55,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'contact_source.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view contact sources.' ); } @@ -63,7 +63,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, ContactSource $contactSource): Response { return $authenticatable->canOrElse( - abilities: ['contact_source.*.view', "contact_source.{$contactSource->id}.view"], + abilities: ["product_admin.{$contactSource->getKey()}.view"], denyResponse: 'You do not have permission to view this contact source.' ); } @@ -71,7 +71,7 @@ public function view(Authenticatable $authenticatable, ContactSource $contactSou public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'contact_source.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create contact sources.' ); } @@ -79,7 +79,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, ContactSource $contactSource): Response { return $authenticatable->canOrElse( - abilities: ['contact_source.*.update', "contact_source.{$contactSource->id}.update"], + abilities: ["product_admin.{$contactSource->getKey()}.update"], denyResponse: 'You do not have permission to update this contact source.' ); } @@ -87,7 +87,7 @@ public function update(Authenticatable $authenticatable, ContactSource $contactS public function delete(Authenticatable $authenticatable, ContactSource $contactSource): Response { return $authenticatable->canOrElse( - abilities: ['contact_source.*.delete', "contact_source.{$contactSource->id}.delete"], + abilities: ["product_admin.{$contactSource->getKey()}.delete"], denyResponse: 'You do not have permission to delete this contact source.' ); } @@ -95,7 +95,7 @@ public function delete(Authenticatable $authenticatable, ContactSource $contactS public function restore(Authenticatable $authenticatable, ContactSource $contactSource): Response { return $authenticatable->canOrElse( - abilities: ['contact_source.*.restore', "contact_source.{$contactSource->id}.restore"], + abilities: ["product_admin.{$contactSource->getKey()}.restore"], denyResponse: 'You do not have permission to restore this contact source.' ); } @@ -103,7 +103,7 @@ public function restore(Authenticatable $authenticatable, ContactSource $contact public function forceDelete(Authenticatable $authenticatable, ContactSource $contactSource): Response { return $authenticatable->canOrElse( - abilities: ['contact_source.*.force-delete', "contact_source.{$contactSource->id}.force-delete"], + abilities: ["product_admin.{$contactSource->getKey()}.force-delete"], denyResponse: 'You do not have permission to force delete this contact source.' ); } diff --git a/app-modules/contact/src/Policies/ContactStatusPolicy.php b/app-modules/contact/src/Policies/ContactStatusPolicy.php index f11e69fe1..a84336e78 100644 --- a/app-modules/contact/src/Policies/ContactStatusPolicy.php +++ b/app-modules/contact/src/Policies/ContactStatusPolicy.php @@ -55,7 +55,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'contact_status.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view contact statuses.' ); } @@ -63,7 +63,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, ContactStatus $contactStatus): Response { return $authenticatable->canOrElse( - abilities: ['contact_status.*.view', "contact_status.{$contactStatus->id}.view"], + abilities: ["product_admin.{$contactStatus->getKey()}.view"], denyResponse: 'You do not have permission to view contact statuses.' ); } @@ -71,7 +71,7 @@ public function view(Authenticatable $authenticatable, ContactStatus $contactSta public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'contact_status.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create contact statuses.' ); } @@ -79,7 +79,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, ContactStatus $contactStatus): Response { return $authenticatable->canOrElse( - abilities: ['contact_status.*.update', "contact_status.{$contactStatus->id}.update"], + abilities: ["product_admin.{$contactStatus->getKey()}.update"], denyResponse: 'You do not have permission to update contact statuses.' ); } @@ -87,7 +87,7 @@ public function update(Authenticatable $authenticatable, ContactStatus $contactS public function delete(Authenticatable $authenticatable, ContactStatus $contactStatus): Response { return $authenticatable->canOrElse( - abilities: ['contact_status.*.delete', "contact_status.{$contactStatus->id}.delete"], + abilities: ["product_admin.{$contactStatus->getKey()}.delete"], denyResponse: 'You do not have permission to delete contact statuses.' ); } @@ -95,7 +95,7 @@ public function delete(Authenticatable $authenticatable, ContactStatus $contactS public function restore(Authenticatable $authenticatable, ContactStatus $contactStatus): Response { return $authenticatable->canOrElse( - abilities: ['contact_status.*.restore', "contact_status.{$contactStatus->id}.restore"], + abilities: ["product_admin.{$contactStatus->getKey()}.restore"], denyResponse: 'You do not have permission to restore contact statuses.' ); } @@ -103,7 +103,7 @@ public function restore(Authenticatable $authenticatable, ContactStatus $contact public function forceDelete(Authenticatable $authenticatable, ContactStatus $contactStatus): Response { return $authenticatable->canOrElse( - abilities: ['contact_status.*.force-delete', "contact_status.{$contactStatus->id}.force-delete"], + abilities: ["product_admin.{$contactStatus->getKey()}.force-delete"], denyResponse: 'You do not have permission to force delete contact statuses.' ); } diff --git a/app-modules/contact/src/Policies/OrganizationIndustryPolicy.php b/app-modules/contact/src/Policies/OrganizationIndustryPolicy.php index d5920bfe5..52b3f6d92 100644 --- a/app-modules/contact/src/Policies/OrganizationIndustryPolicy.php +++ b/app-modules/contact/src/Policies/OrganizationIndustryPolicy.php @@ -55,7 +55,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'organization_industry.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view organization industries.' ); } @@ -63,15 +63,15 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, OrganizationIndustry $organizationIndustry): Response { return $authenticatable->canOrElse( - abilities: ['organization_industry.*.view', "organization_industry.{ {$organizationIndustry->id}}.view"], - denyResponse: 'You do not have permission to view this organization industries.' + abilities: ["product_admin.{$organizationIndustry->getKey()}.view"], + denyResponse: 'You do not have permission to view this organization industry.' ); } public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'organization_industry.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create organization industries.' ); } @@ -79,7 +79,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, OrganizationIndustry $organizationIndustry): Response { return $authenticatable->canOrElse( - abilities: ['organization_industry.*.update', "organization_industry.{ {$organizationIndustry->id}}.update"], + abilities: ["product_admin.{$organizationIndustry->getKey()}.update"], denyResponse: 'You do not have permission to update this organization industry.' ); } @@ -87,7 +87,7 @@ public function update(Authenticatable $authenticatable, OrganizationIndustry $o public function delete(Authenticatable $authenticatable, OrganizationIndustry $organizationIndustry): Response { return $authenticatable->canOrElse( - abilities: ['organization_industry.*.delete', "organization_industry.{ {$organizationIndustry->id}}.delete"], + abilities: ["product_admin.{$organizationIndustry->getKey()}.delete"], denyResponse: 'You do not have permission to delete this organization industry.' ); } @@ -95,7 +95,7 @@ public function delete(Authenticatable $authenticatable, OrganizationIndustry $o public function restore(Authenticatable $authenticatable, OrganizationIndustry $organizationIndustry): Response { return $authenticatable->canOrElse( - abilities: ['organization_industry.*.restore', "organization_industry.{ {$organizationIndustry->id}}.restore"], + abilities: ["product_admin.{$organizationIndustry->getKey()}.restore"], denyResponse: 'You do not have permission to restore this organization industry.' ); } @@ -103,7 +103,7 @@ public function restore(Authenticatable $authenticatable, OrganizationIndustry $ public function forceDelete(Authenticatable $authenticatable, OrganizationIndustry $organizationIndustry): Response { return $authenticatable->canOrElse( - abilities: ['organization_industry.*.force-delete', "organization_industry.{ {$organizationIndustry->id}}.force-delete"], + abilities: ["product_admin.{$organizationIndustry->getKey()}.force-delete"], denyResponse: 'You do not have permission to force delete this organization industry.' ); } diff --git a/app-modules/contact/src/Policies/OrganizationTypePolicy.php b/app-modules/contact/src/Policies/OrganizationTypePolicy.php index fb56c487f..629db02cd 100644 --- a/app-modules/contact/src/Policies/OrganizationTypePolicy.php +++ b/app-modules/contact/src/Policies/OrganizationTypePolicy.php @@ -55,7 +55,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'organization_type.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view organization types.' ); } @@ -63,7 +63,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, OrganizationType $organizationType): Response { return $authenticatable->canOrElse( - abilities: ['organization_type.*.view', "organization_type.{$organizationType->id}.view"], + abilities: ["product_admin.{$organizationType->getKey()}.view"], denyResponse: 'You do not have permission to view this organization types.' ); } @@ -71,7 +71,7 @@ public function view(Authenticatable $authenticatable, OrganizationType $organiz public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'organization_type.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create organization types.' ); } @@ -79,7 +79,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, OrganizationType $organizationType): Response { return $authenticatable->canOrElse( - abilities: ['organization_type.*.update', "organization_type.{$organizationType->id}.update"], + abilities: ["product_admin.{$organizationType->getKey()}.update"], denyResponse: 'You do not have permission to update this organization type.' ); } @@ -87,7 +87,7 @@ public function update(Authenticatable $authenticatable, OrganizationType $organ public function delete(Authenticatable $authenticatable, OrganizationType $organizationType): Response { return $authenticatable->canOrElse( - abilities: ['organization_type.*.delete', "organization_type.{$organizationType->id}.delete"], + abilities: ["product_admin.{$organizationType->getKey()}.delete"], denyResponse: 'You do not have permission to delete this organization type.' ); } @@ -95,7 +95,7 @@ public function delete(Authenticatable $authenticatable, OrganizationType $organ public function restore(Authenticatable $authenticatable, OrganizationType $organizationType): Response { return $authenticatable->canOrElse( - abilities: ['organization_type.*.restore', "organization_type.{$organizationType->id}.restore"], + abilities: ["product_admin.{$organizationType->getKey()}.restore"], denyResponse: 'You do not have permission to restore this organization type.' ); } @@ -103,7 +103,7 @@ public function restore(Authenticatable $authenticatable, OrganizationType $orga public function forceDelete(Authenticatable $authenticatable, OrganizationType $organizationType): Response { return $authenticatable->canOrElse( - abilities: ['organization_type.*.force-delete', "organization_type.{$organizationType->id}.force-delete"], + abilities: ["product_admin.{$organizationType->getKey()}.force-delete"], denyResponse: 'You do not have permission to force delete this organization type.' ); } diff --git a/app-modules/contact/tests/ContactSource/CreateContactSourceTest.php b/app-modules/contact/tests/ContactSource/CreateContactSourceTest.php index 076639123..8d989e4ee 100644 --- a/app-modules/contact/tests/ContactSource/CreateContactSourceTest.php +++ b/app-modules/contact/tests/ContactSource/CreateContactSourceTest.php @@ -98,8 +98,8 @@ livewire(ContactSourceResource\Pages\CreateContactSource::class) ->assertForbidden(); - $user->givePermissionTo('contact_source.view-any'); - $user->givePermissionTo('contact_source.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/ContactSource/EditContactSourceTest.php b/app-modules/contact/tests/ContactSource/EditContactSourceTest.php index 974806826..cb6a4f4fe 100644 --- a/app-modules/contact/tests/ContactSource/EditContactSourceTest.php +++ b/app-modules/contact/tests/ContactSource/EditContactSourceTest.php @@ -117,8 +117,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('contact_source.view-any'); - $user->givePermissionTo('contact_source.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/ContactSource/ListContactSourcesTest.php b/app-modules/contact/tests/ContactSource/ListContactSourcesTest.php index a62db30f3..678d1c17a 100644 --- a/app-modules/contact/tests/ContactSource/ListContactSourcesTest.php +++ b/app-modules/contact/tests/ContactSource/ListContactSourcesTest.php @@ -90,7 +90,7 @@ ContactSourceResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('contact_source.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/ContactSource/ViewContactSourceTest.php b/app-modules/contact/tests/ContactSource/ViewContactSourceTest.php index 70c040e69..91b009a3e 100644 --- a/app-modules/contact/tests/ContactSource/ViewContactSourceTest.php +++ b/app-modules/contact/tests/ContactSource/ViewContactSourceTest.php @@ -75,8 +75,8 @@ ]) )->assertForbidden(); - $user->givePermissionTo('contact_source.view-any'); - $user->givePermissionTo('contact_source.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/ContactStatus/CreateContactStatusTest.php b/app-modules/contact/tests/ContactStatus/CreateContactStatusTest.php index 970366dbb..6fa2c6865 100644 --- a/app-modules/contact/tests/ContactStatus/CreateContactStatusTest.php +++ b/app-modules/contact/tests/ContactStatus/CreateContactStatusTest.php @@ -101,8 +101,8 @@ livewire(ContactStatusResource\Pages\CreateContactStatus::class) ->assertForbidden(); - $user->givePermissionTo('contact_status.view-any'); - $user->givePermissionTo('contact_status.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/ContactStatus/EditContactStatusTest.php b/app-modules/contact/tests/ContactStatus/EditContactStatusTest.php index c9f7344f3..04c5a7d86 100644 --- a/app-modules/contact/tests/ContactStatus/EditContactStatusTest.php +++ b/app-modules/contact/tests/ContactStatus/EditContactStatusTest.php @@ -126,8 +126,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('contact_status.view-any'); - $user->givePermissionTo('contact_status.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/ContactStatus/ListContactStatusesTest.php b/app-modules/contact/tests/ContactStatus/ListContactStatusesTest.php index 328a61c96..e78de2f3b 100644 --- a/app-modules/contact/tests/ContactStatus/ListContactStatusesTest.php +++ b/app-modules/contact/tests/ContactStatus/ListContactStatusesTest.php @@ -100,7 +100,7 @@ ContactStatusResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('contact_status.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/ContactStatus/ViewContactStatusTest.php b/app-modules/contact/tests/ContactStatus/ViewContactStatusTest.php index 7cce85835..0cfb5890d 100644 --- a/app-modules/contact/tests/ContactStatus/ViewContactStatusTest.php +++ b/app-modules/contact/tests/ContactStatus/ViewContactStatusTest.php @@ -79,8 +79,8 @@ ]) )->assertForbidden(); - $user->givePermissionTo('contact_status.view-any'); - $user->givePermissionTo('contact_status.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/OrganizationIndustry/CreateOrganizationIndustryTest.php b/app-modules/contact/tests/OrganizationIndustry/CreateOrganizationIndustryTest.php index 3c2af1621..08479865f 100644 --- a/app-modules/contact/tests/OrganizationIndustry/CreateOrganizationIndustryTest.php +++ b/app-modules/contact/tests/OrganizationIndustry/CreateOrganizationIndustryTest.php @@ -60,8 +60,8 @@ livewire(CreateOrganizationIndustry::class) ->assertForbidden(); - $user->givePermissionTo('organization_industry.view-any'); - $user->givePermissionTo('organization_industry.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( @@ -71,8 +71,8 @@ test('Create New Organization Industry', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $user->givePermissionTo('organization_industry.view-any'); - $user->givePermissionTo('organization_industry.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user); diff --git a/app-modules/contact/tests/OrganizationIndustry/EditOrganizationIndustryTest.php b/app-modules/contact/tests/OrganizationIndustry/EditOrganizationIndustryTest.php index 82249ed5b..da63a63ca 100644 --- a/app-modules/contact/tests/OrganizationIndustry/EditOrganizationIndustryTest.php +++ b/app-modules/contact/tests/OrganizationIndustry/EditOrganizationIndustryTest.php @@ -47,53 +47,53 @@ test('Edit Organization Industry is gated with proper access control', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $organization_industry = OrganizationIndustry::factory()->create(); + $organizationIndustry = OrganizationIndustry::factory()->create(); actingAs($user) ->get( OrganizationIndustryResource::getUrl('edit', [ - 'record' => $organization_industry, + 'record' => $organizationIndustry, ]) )->assertForbidden(); livewire(EditOrganizationIndustry::class, [ - 'record' => $organization_industry->getRouteKey(), + 'record' => $organizationIndustry->getRouteKey(), ]) ->assertForbidden(); - $user->givePermissionTo('organization_industry.view-any'); - $user->givePermissionTo('organization_industry.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( OrganizationIndustryResource::getUrl('edit', [ - 'record' => $organization_industry, + 'record' => $organizationIndustry, ]) )->assertSuccessful(); livewire(EditOrganizationIndustry::class, [ - 'record' => $organization_industry->getRouteKey(), + 'record' => $organizationIndustry->getRouteKey(), ]) ->assertSuccessful(); }); test('Edit Organization Industry Record', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $organization_industry = OrganizationIndustry::factory()->create(); + $organizationIndustry = OrganizationIndustry::factory()->create(); - $user->givePermissionTo('organization_industry.view-any'); - $user->givePermissionTo('organization_industry.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user); $request = collect(EditOrganizationIndustryRequestFactory::new()->create()); livewire(EditOrganizationIndustry::class, [ - 'record' => $organization_industry->getRouteKey(), + 'record' => $organizationIndustry->getRouteKey(), ]) ->fillForm($request->toArray()) ->call('save') ->assertHasNoFormErrors(); - $organization_industry->refresh(); + $organizationIndustry->refresh(); - expect($organization_industry->name)->toEqual($request->get('name')); + expect($organizationIndustry->name)->toEqual($request->get('name')); }); diff --git a/app-modules/contact/tests/OrganizationIndustry/ListOrganizationIndustryTest.php b/app-modules/contact/tests/OrganizationIndustry/ListOrganizationIndustryTest.php index fc33c357c..8598ebfd5 100644 --- a/app-modules/contact/tests/OrganizationIndustry/ListOrganizationIndustryTest.php +++ b/app-modules/contact/tests/OrganizationIndustry/ListOrganizationIndustryTest.php @@ -49,7 +49,7 @@ OrganizationIndustryResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('organization_industry.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/OrganizationIndustry/ViewOrganizationIndustryTest.php b/app-modules/contact/tests/OrganizationIndustry/ViewOrganizationIndustryTest.php index e12c9fe29..b2c13d616 100644 --- a/app-modules/contact/tests/OrganizationIndustry/ViewOrganizationIndustryTest.php +++ b/app-modules/contact/tests/OrganizationIndustry/ViewOrganizationIndustryTest.php @@ -45,22 +45,22 @@ test('View OrganizationIndustry is gated with proper access control', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $organization_industry = OrganizationIndustry::factory()->create(); + $organizationIndustry = OrganizationIndustry::factory()->create(); actingAs($user) ->get( OrganizationIndustryResource::getUrl('view', [ - 'record' => $organization_industry, + 'record' => $organizationIndustry, ]) )->assertForbidden(); - $user->givePermissionTo('organization_industry.view-any'); - $user->givePermissionTo('organization_industry.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( OrganizationIndustryResource::getUrl('view', [ - 'record' => $organization_industry, + 'record' => $organizationIndustry, ]) )->assertSuccessful(); }); diff --git a/app-modules/contact/tests/OrganizationType/CreateOrganizationTypeTest.php b/app-modules/contact/tests/OrganizationType/CreateOrganizationTypeTest.php index 705033a43..2ee279e73 100644 --- a/app-modules/contact/tests/OrganizationType/CreateOrganizationTypeTest.php +++ b/app-modules/contact/tests/OrganizationType/CreateOrganizationTypeTest.php @@ -60,8 +60,8 @@ livewire(CreateOrganizationType::class) ->assertForbidden(); - $user->givePermissionTo('organization_type.view-any'); - $user->givePermissionTo('organization_type.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( @@ -74,8 +74,8 @@ test('Create New Organization Type', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $user->givePermissionTo('organization_type.view-any'); - $user->givePermissionTo('organization_type.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/OrganizationType/EditOrganizationTypeTest.php b/app-modules/contact/tests/OrganizationType/EditOrganizationTypeTest.php index 16e4e9de4..0bd1fb673 100644 --- a/app-modules/contact/tests/OrganizationType/EditOrganizationTypeTest.php +++ b/app-modules/contact/tests/OrganizationType/EditOrganizationTypeTest.php @@ -47,53 +47,53 @@ test('Edit Organization Type is gated with proper access control', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $organization_type = OrganizationType::factory()->create(); + $organizationType = OrganizationType::factory()->create(); actingAs($user) ->get( OrganizationTypeResource::getUrl('edit', [ - 'record' => $organization_type, + 'record' => $organizationType, ]) )->assertForbidden(); livewire(EditOrganizationType::class, [ - 'record' => $organization_type->getRouteKey(), + 'record' => $organizationType->getRouteKey(), ]) ->assertForbidden(); - $user->givePermissionTo('organization_type.view-any'); - $user->givePermissionTo('organization_type.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( OrganizationTypeResource::getUrl('edit', [ - 'record' => $organization_type, + 'record' => $organizationType, ]) )->assertSuccessful(); livewire(EditOrganizationType::class, [ - 'record' => $organization_type->getRouteKey(), + 'record' => $organizationType->getRouteKey(), ])->assertSuccessful(); }); test('Edit Organization Type Record', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $organization_type = OrganizationType::factory()->create(); + $organizationType = OrganizationType::factory()->create(); - $user->givePermissionTo('organization_type.view-any'); - $user->givePermissionTo('organization_type.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user); $request = collect(EditOrganizationTypeRequestFactory::new()->create()); livewire(EditOrganizationType::class, [ - 'record' => $organization_type->getRouteKey(), + 'record' => $organizationType->getRouteKey(), ]) ->fillForm($request->toArray()) ->call('save') ->assertHasNoFormErrors(); - $organization_type->refresh(); + $organizationType->refresh(); - expect($organization_type->name)->toEqual($request->get('name')); + expect($organizationType->name)->toEqual($request->get('name')); }); diff --git a/app-modules/contact/tests/OrganizationType/ListOrganizationTypeTest.php b/app-modules/contact/tests/OrganizationType/ListOrganizationTypeTest.php index 82526edf9..50d3df77d 100644 --- a/app-modules/contact/tests/OrganizationType/ListOrganizationTypeTest.php +++ b/app-modules/contact/tests/OrganizationType/ListOrganizationTypeTest.php @@ -49,7 +49,7 @@ OrganizationTypeResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('organization_type.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( diff --git a/app-modules/contact/tests/OrganizationType/ViewOrganizationTypeTest.php b/app-modules/contact/tests/OrganizationType/ViewOrganizationTypeTest.php index 9372c8d00..b27183641 100644 --- a/app-modules/contact/tests/OrganizationType/ViewOrganizationTypeTest.php +++ b/app-modules/contact/tests/OrganizationType/ViewOrganizationTypeTest.php @@ -45,22 +45,22 @@ test('View OrganizationType is gated with proper access control', function () { $user = User::factory()->licensed(Contact::getLicenseType())->create(); - $organization_type = OrganizationType::factory()->create(); + $organizationType = OrganizationType::factory()->create(); actingAs($user) ->get( OrganizationTypeResource::getUrl('view', [ - 'record' => $organization_type, + 'record' => $organizationType, ]) )->assertForbidden(); - $user->givePermissionTo('organization_type.view-any'); - $user->givePermissionTo('organization_type.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( OrganizationTypeResource::getUrl('view', [ - 'record' => $organization_type, + 'record' => $organizationType, ]) )->assertSuccessful(); }); diff --git a/app-modules/division/src/Filament/Resources/DivisionResource.php b/app-modules/division/src/Filament/Resources/DivisionResource.php index b2efc2393..5baeb2768 100644 --- a/app-modules/division/src/Filament/Resources/DivisionResource.php +++ b/app-modules/division/src/Filament/Resources/DivisionResource.php @@ -38,7 +38,6 @@ use Filament\Resources\Resource; use AidingApp\Division\Models\Division; -use App\Filament\Clusters\UserManagement; use AidingApp\Division\Filament\Resources\DivisionResource\Pages\EditDivision; use AidingApp\Division\Filament\Resources\DivisionResource\Pages\ViewDivision; use AidingApp\Division\Filament\Resources\DivisionResource\Pages\ListDivisions; @@ -49,9 +48,7 @@ class DivisionResource extends Resource { protected static ?string $model = Division::class; - protected static ?string $navigationIcon = 'heroicon-o-bars-2'; - - protected static ?string $cluster = UserManagement::class; + protected static ?string $navigationGroup = 'People Administration'; protected static ?int $navigationSort = 60; diff --git a/app-modules/engagement/src/Policies/EmailTemplatePolicy.php b/app-modules/engagement/src/Policies/EmailTemplatePolicy.php index 062781805..ed4f5d177 100644 --- a/app-modules/engagement/src/Policies/EmailTemplatePolicy.php +++ b/app-modules/engagement/src/Policies/EmailTemplatePolicy.php @@ -45,7 +45,7 @@ class EmailTemplatePolicy public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'email_template.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view email templates.' ); } @@ -53,7 +53,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, EmailTemplate $emailTemplate): Response { return $authenticatable->canOrElse( - abilities: ['email_template.*.view', "email_template.{$emailTemplate->id}.view"], + abilities: ["product_admin.{$emailTemplate->getKey()}.view"], denyResponse: 'You do not have permission to view this email template.' ); } @@ -61,7 +61,7 @@ public function view(Authenticatable $authenticatable, EmailTemplate $emailTempl public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'email_template.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create email templates.' ); } @@ -69,7 +69,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, EmailTemplate $emailTemplate): Response { return $authenticatable->canOrElse( - abilities: ['email_template.*.update', "email_template.{$emailTemplate->id}.update"], + abilities: ["product_admin.{$emailTemplate->getKey()}.update"], denyResponse: 'You do not have permission to update this email template.' ); } @@ -77,7 +77,7 @@ public function update(Authenticatable $authenticatable, EmailTemplate $emailTem public function delete(Authenticatable $authenticatable, EmailTemplate $emailTemplate): Response { return $authenticatable->canOrElse( - abilities: ['email_template.*.delete', "email_template.{$emailTemplate->id}.delete"], + abilities: ["product_admin.{$emailTemplate->getKey()}.delete"], denyResponse: 'You do not have permission to delete this email template.' ); } @@ -85,7 +85,7 @@ public function delete(Authenticatable $authenticatable, EmailTemplate $emailTem public function restore(Authenticatable $authenticatable, EmailTemplate $emailTemplate): Response { return $authenticatable->canOrElse( - abilities: ['email_template.*.restore', "email_template.{$emailTemplate->id}.restore"], + abilities: ["product_admin.{$emailTemplate->getKey()}.restore"], denyResponse: 'You do not have permission to restore this email template.' ); } @@ -93,7 +93,7 @@ public function restore(Authenticatable $authenticatable, EmailTemplate $emailTe public function forceDelete(Authenticatable $authenticatable, EmailTemplate $emailTemplate): Response { return $authenticatable->canOrElse( - abilities: ['email_template.*.force-delete', "email_template.{$emailTemplate->id}.force-delete"], + abilities: ["product_admin.{$emailTemplate->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this email template.' ); } diff --git a/app-modules/engagement/src/Policies/SmsTemplatePolicy.php b/app-modules/engagement/src/Policies/SmsTemplatePolicy.php index 8675e43ee..b1f4a2483 100644 --- a/app-modules/engagement/src/Policies/SmsTemplatePolicy.php +++ b/app-modules/engagement/src/Policies/SmsTemplatePolicy.php @@ -45,7 +45,7 @@ class SmsTemplatePolicy public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'sms_template.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view sms templates.' ); } @@ -53,7 +53,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, SmsTemplate $smsTemplate): Response { return $authenticatable->canOrElse( - abilities: ['sms_template.*.view', "sms_template.{$smsTemplate->id}.view"], + abilities: ["product_admin.{$smsTemplate->getKey()}.view"], denyResponse: 'You do not have permission to view this sms template.' ); } @@ -61,7 +61,7 @@ public function view(Authenticatable $authenticatable, SmsTemplate $smsTemplate) public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'sms_template.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create sms templates.' ); } @@ -69,7 +69,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, SmsTemplate $smsTemplate): Response { return $authenticatable->canOrElse( - abilities: ['sms_template.*.update', "sms_template.{$smsTemplate->id}.update"], + abilities: ["product_admin.{$smsTemplate->getKey()}.update"], denyResponse: 'You do not have permission to update this sms template.' ); } @@ -77,7 +77,7 @@ public function update(Authenticatable $authenticatable, SmsTemplate $smsTemplat public function delete(Authenticatable $authenticatable, SmsTemplate $smsTemplate): Response { return $authenticatable->canOrElse( - abilities: ['sms_template.*.delete', "sms_template.{$smsTemplate->id}.delete"], + abilities: ["product_admin.{$smsTemplate->getKey()}.delete"], denyResponse: 'You do not have permission to delete this sms template.' ); } @@ -85,7 +85,7 @@ public function delete(Authenticatable $authenticatable, SmsTemplate $smsTemplat public function restore(Authenticatable $authenticatable, SmsTemplate $smsTemplate): Response { return $authenticatable->canOrElse( - abilities: ['sms_template.*.restore', "sms_template.{$smsTemplate->id}.restore"], + abilities: ["product_admin.{$smsTemplate->getKey()}.restore"], denyResponse: 'You do not have permission to restore this sms template.' ); } @@ -93,7 +93,7 @@ public function restore(Authenticatable $authenticatable, SmsTemplate $smsTempla public function forceDelete(Authenticatable $authenticatable, SmsTemplate $smsTemplate): Response { return $authenticatable->canOrElse( - abilities: ['sms_template.*.force-delete', "sms_template.{$smsTemplate->id}.force-delete"], + abilities: ["product_admin.{$smsTemplate->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this sms template.' ); } diff --git a/app-modules/knowledge-base/src/Policies/KnowledgeBaseCategoryPolicy.php b/app-modules/knowledge-base/src/Policies/KnowledgeBaseCategoryPolicy.php index 0670f449e..5684b2135 100644 --- a/app-modules/knowledge-base/src/Policies/KnowledgeBaseCategoryPolicy.php +++ b/app-modules/knowledge-base/src/Policies/KnowledgeBaseCategoryPolicy.php @@ -66,7 +66,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'knowledge_base_category.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permissions to view knowledge base categories.' ); } @@ -74,7 +74,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, KnowledgeBaseCategory $knowledgeBaseCategory): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_category.*.view', "knowledge_base_category.{$knowledgeBaseCategory->id}.view"], + abilities: ["product_admin.{$knowledgeBaseCategory->getKey()}.view"], denyResponse: 'You do not have permissions to view this knowledge base category.' ); } @@ -82,7 +82,7 @@ public function view(Authenticatable $authenticatable, KnowledgeBaseCategory $kn public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'knowledge_base_category.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permissions to create knowledge base categories.' ); } @@ -90,7 +90,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, KnowledgeBaseCategory $knowledgeBaseCategory): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_category.*.update', "knowledge_base_category.{$knowledgeBaseCategory->id}.update"], + abilities: ["product_admin.{$knowledgeBaseCategory->getKey()}.update"], denyResponse: 'You do not have permissions to update this knowledge base category.' ); } @@ -98,7 +98,7 @@ public function update(Authenticatable $authenticatable, KnowledgeBaseCategory $ public function delete(Authenticatable $authenticatable, KnowledgeBaseCategory $knowledgeBaseCategory): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_category.*.delete', "knowledge_base_category.{$knowledgeBaseCategory->id}.delete"], + abilities: ["product_admin.{$knowledgeBaseCategory->getKey()}.delete"], denyResponse: 'You do not have permissions to delete this knowledge base category.' ); } @@ -106,7 +106,7 @@ public function delete(Authenticatable $authenticatable, KnowledgeBaseCategory $ public function restore(Authenticatable $authenticatable, KnowledgeBaseCategory $knowledgeBaseCategory): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_category.*.restore', "knowledge_base_category.{$knowledgeBaseCategory->id}.restore"], + abilities: ["product_admin.{$knowledgeBaseCategory->getKey()}.restore"], denyResponse: 'You do not have permissions to restore this knowledge base category.' ); } @@ -114,7 +114,7 @@ public function restore(Authenticatable $authenticatable, KnowledgeBaseCategory public function forceDelete(Authenticatable $authenticatable, KnowledgeBaseCategory $knowledgeBaseCategory): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_category.*.force-delete', "knowledge_base_category.{$knowledgeBaseCategory->id}.force-delete"], + abilities: ["product_admin.{$knowledgeBaseCategory->getKey()}.force-delete"], denyResponse: 'You do not have permissions to permanently delete this knowledge base category.' ); } diff --git a/app-modules/knowledge-base/src/Policies/KnowledgeBaseQualityPolicy.php b/app-modules/knowledge-base/src/Policies/KnowledgeBaseQualityPolicy.php index e4660a462..954fd177e 100644 --- a/app-modules/knowledge-base/src/Policies/KnowledgeBaseQualityPolicy.php +++ b/app-modules/knowledge-base/src/Policies/KnowledgeBaseQualityPolicy.php @@ -66,7 +66,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'knowledge_base_quality.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view any knowledge base categories.' ); } @@ -74,7 +74,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, KnowledgeBaseQuality $knowledgeBaseQuality): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_quality.*.view', "knowledge_base_quality.{$knowledgeBaseQuality->id}.view"], + abilities: ["product_admin.{$knowledgeBaseQuality->getKey()}.view"], denyResponse: 'You do not have permission to view this knowledge base category.' ); } @@ -82,7 +82,7 @@ public function view(Authenticatable $authenticatable, KnowledgeBaseQuality $kno public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'knowledge_base_quality.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create knowledge base categories.' ); } @@ -90,7 +90,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, KnowledgeBaseQuality $knowledgeBaseQuality): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_quality.*.update', "knowledge_base_quality.{$knowledgeBaseQuality->id}.update"], + abilities: ["product_admin.{$knowledgeBaseQuality->getKey()}.update"], denyResponse: 'You do not have permission to update this knowledge base category.' ); } @@ -98,7 +98,7 @@ public function update(Authenticatable $authenticatable, KnowledgeBaseQuality $k public function delete(Authenticatable $authenticatable, KnowledgeBaseQuality $knowledgeBaseQuality): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_quality.*.delete', "knowledge_base_quality.{$knowledgeBaseQuality->id}.delete"], + abilities: ["product_admin.{$knowledgeBaseQuality->getKey()}.delete"], denyResponse: 'You do not have permission to delete this knowledge base category.' ); } @@ -106,7 +106,7 @@ public function delete(Authenticatable $authenticatable, KnowledgeBaseQuality $k public function restore(Authenticatable $authenticatable, KnowledgeBaseQuality $knowledgeBaseQuality): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_quality.*.restore', "knowledge_base_quality.{$knowledgeBaseQuality->id}.restore"], + abilities: ["product_admin.{$knowledgeBaseQuality->getKey()}.restore"], denyResponse: 'You do not have permission to restore this knowledge base category.' ); } @@ -114,7 +114,7 @@ public function restore(Authenticatable $authenticatable, KnowledgeBaseQuality $ public function forceDelete(Authenticatable $authenticatable, KnowledgeBaseQuality $knowledgeBaseQuality): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_quality.*.force-delete', "knowledge_base_quality.{$knowledgeBaseQuality->id}.force-delete"], + abilities: ["product_admin.{$knowledgeBaseQuality->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this knowledge base category.' ); } diff --git a/app-modules/knowledge-base/src/Policies/KnowledgeBaseStatusPolicy.php b/app-modules/knowledge-base/src/Policies/KnowledgeBaseStatusPolicy.php index a3ffdbe03..7e2c2ae88 100644 --- a/app-modules/knowledge-base/src/Policies/KnowledgeBaseStatusPolicy.php +++ b/app-modules/knowledge-base/src/Policies/KnowledgeBaseStatusPolicy.php @@ -66,7 +66,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'knowledge_base_status.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view any knowledge base statuses.' ); } @@ -74,7 +74,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, KnowledgeBaseStatus $knowledgeBaseStatus): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_status.*.view', "knowledge_base_status.{$knowledgeBaseStatus->id}.view"], + abilities: ["product_admin.{$knowledgeBaseStatus->getKey()}.view"], denyResponse: 'You do not have permission to view this knowledge base status.' ); } @@ -82,7 +82,7 @@ public function view(Authenticatable $authenticatable, KnowledgeBaseStatus $know public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'knowledge_base_status.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create knowledge base statuses.' ); } @@ -90,7 +90,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, KnowledgeBaseStatus $knowledgeBaseStatus): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_status.*.update', "knowledge_base_status.{$knowledgeBaseStatus->id}.update"], + abilities: ["product_admin.{$knowledgeBaseStatus->getKey()}.update"], denyResponse: 'You do not have permission to update this knowledge base status.' ); } @@ -98,7 +98,7 @@ public function update(Authenticatable $authenticatable, KnowledgeBaseStatus $kn public function delete(Authenticatable $authenticatable, KnowledgeBaseStatus $knowledgeBaseStatus): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_status.*.delete', "knowledge_base_status.{$knowledgeBaseStatus->id}.delete"], + abilities: ["product_admin.{$knowledgeBaseStatus->getKey()}.delete"], denyResponse: 'You do not have permission to delete this knowledge base status.' ); } @@ -106,7 +106,7 @@ public function delete(Authenticatable $authenticatable, KnowledgeBaseStatus $kn public function restore(Authenticatable $authenticatable, KnowledgeBaseStatus $knowledgeBaseStatus): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_status.*.restore', "knowledge_base_status.{$knowledgeBaseStatus->id}.restore"], + abilities: ["product_admin.{$knowledgeBaseStatus->getKey()}.restore"], denyResponse: 'You do not have permission to restore this knowledge base status.' ); } @@ -114,7 +114,7 @@ public function restore(Authenticatable $authenticatable, KnowledgeBaseStatus $k public function forceDelete(Authenticatable $authenticatable, KnowledgeBaseStatus $knowledgeBaseStatus): Response { return $authenticatable->canOrElse( - abilities: ['knowledge_base_status.*.force-delete', "knowledge_base_status.{$knowledgeBaseStatus->id}.force-delete"], + abilities: ["product_admin.{$knowledgeBaseStatus->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this knowledge base status.' ); } diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/CreateKnowledgeBaseCategoryTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/CreateKnowledgeBaseCategoryTest.php index 00c201156..7951a43bb 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/CreateKnowledgeBaseCategoryTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/CreateKnowledgeBaseCategoryTest.php @@ -65,8 +65,8 @@ livewire(KnowledgeBaseCategoryResource\Pages\CreateKnowledgeBaseCategory::class) ->assertForbidden(); - $user->givePermissionTo('knowledge_base_category.view-any'); - $user->givePermissionTo('knowledge_base_category.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( @@ -94,8 +94,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_category.view-any'); - $user->givePermissionTo('knowledge_base_category.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/EditKnowledgeBaseCategoryTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/EditKnowledgeBaseCategoryTest.php index a8dd874a9..aad32b200 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/EditKnowledgeBaseCategoryTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/EditKnowledgeBaseCategoryTest.php @@ -70,8 +70,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('knowledge_base_category.view-any'); - $user->givePermissionTo('knowledge_base_category.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( @@ -101,8 +101,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_category.view-any'); - $user->givePermissionTo('knowledge_base_category.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); $knowledgeBaseCategory = KnowledgeBaseCategory::factory()->create(); diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ListKnowledgeBaseCategoryTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ListKnowledgeBaseCategoryTest.php index bbba6f96e..11c68e396 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ListKnowledgeBaseCategoryTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ListKnowledgeBaseCategoryTest.php @@ -57,7 +57,7 @@ KnowledgeBaseCategoryResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('knowledge_base_category.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -74,7 +74,7 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_category.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -103,7 +103,7 @@ // And the authenticatable has the correct permissions // But they do not have the appropriate license - $user->givePermissionTo('knowledge_base_category.view-any'); + $user->givePermissionTo('product_admin.view-any'); // They should not be able to access the resource actingAs($user) diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ViewKnowledgeBaseCategoryTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ViewKnowledgeBaseCategoryTest.php index e7970494a..6b636fed1 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ViewKnowledgeBaseCategoryTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseCategory/ViewKnowledgeBaseCategoryTest.php @@ -60,8 +60,8 @@ ]) )->assertForbidden(); - $user->givePermissionTo('knowledge_base_category.view-any'); - $user->givePermissionTo('knowledge_base_category.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( @@ -80,8 +80,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_category.view-any'); - $user->givePermissionTo('knowledge_base_category.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); $knowledgeBaseCategory = KnowledgeBaseCategory::factory()->create(); diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/CreateKnowledgeBaseQualityTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/CreateKnowledgeBaseQualityTest.php index c6fa8832d..439a40c0f 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/CreateKnowledgeBaseQualityTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/CreateKnowledgeBaseQualityTest.php @@ -65,8 +65,8 @@ livewire(KnowledgeBaseQualityResource\Pages\CreateKnowledgeBaseQuality::class) ->assertForbidden(); - $user->givePermissionTo('knowledge_base_quality.view-any'); - $user->givePermissionTo('knowledge_base_quality.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( @@ -94,8 +94,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_quality.view-any'); - $user->givePermissionTo('knowledge_base_quality.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/EditKnowledgeBaseCategoryTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/EditKnowledgeBaseCategoryTest.php index 522c59a9a..1580e9b89 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/EditKnowledgeBaseCategoryTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/EditKnowledgeBaseCategoryTest.php @@ -70,8 +70,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('knowledge_base_quality.view-any'); - $user->givePermissionTo('knowledge_base_quality.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( @@ -101,8 +101,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_quality.view-any'); - $user->givePermissionTo('knowledge_base_quality.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); $knowledgeBaseQuality = KnowledgeBaseQuality::factory()->create(); diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ListKnowledgeBaseQualityTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ListKnowledgeBaseQualityTest.php index d6483fbc0..eb432f7a2 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ListKnowledgeBaseQualityTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ListKnowledgeBaseQualityTest.php @@ -57,7 +57,7 @@ KnowledgeBaseQualityResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('knowledge_base_quality.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -74,7 +74,7 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_quality.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -103,7 +103,7 @@ // And the authenticatable has the correct permissions // But they do not have the appropriate license - $user->givePermissionTo('knowledge_base_quality.view-any'); + $user->givePermissionTo('product_admin.view-any'); // They should not be able to access the resource actingAs($user) diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ViewKnowledgeBaseQualityTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ViewKnowledgeBaseQualityTest.php index c80159f64..bd313a4e3 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ViewKnowledgeBaseQualityTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseQuality/ViewKnowledgeBaseQualityTest.php @@ -60,8 +60,8 @@ ]) )->assertForbidden(); - $user->givePermissionTo('knowledge_base_quality.view-any'); - $user->givePermissionTo('knowledge_base_quality.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( @@ -80,8 +80,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_quality.view-any'); - $user->givePermissionTo('knowledge_base_quality.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); $knowledgeBaseQuality = KnowledgeBaseQuality::factory()->create(); diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/CreateKnowledgeBaseStatusTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/CreateKnowledgeBaseStatusTest.php index be2d51c7c..47fd29e18 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/CreateKnowledgeBaseStatusTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/CreateKnowledgeBaseStatusTest.php @@ -65,8 +65,8 @@ livewire(KnowledgeBaseStatusResource\Pages\CreateKnowledgeBaseStatus::class) ->assertForbidden(); - $user->givePermissionTo('knowledge_base_status.view-any'); - $user->givePermissionTo('knowledge_base_status.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( @@ -94,8 +94,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_status.view-any'); - $user->givePermissionTo('knowledge_base_status.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/EditKnowledgeBaseStatusTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/EditKnowledgeBaseStatusTest.php index 6cb364bdd..d57e8f084 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/EditKnowledgeBaseStatusTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/EditKnowledgeBaseStatusTest.php @@ -70,8 +70,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('knowledge_base_status.view-any'); - $user->givePermissionTo('knowledge_base_status.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( @@ -101,8 +101,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_status.view-any'); - $user->givePermissionTo('knowledge_base_status.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); $knowledgeBaseStatus = KnowledgeBaseStatus::factory()->create(); diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ListKnowledgeBaseStatusesTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ListKnowledgeBaseStatusesTest.php index 73783ad8c..63940fb60 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ListKnowledgeBaseStatusesTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ListKnowledgeBaseStatusesTest.php @@ -57,7 +57,7 @@ KnowledgeBaseStatusResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('knowledge_base_status.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -74,7 +74,7 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_status.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -103,7 +103,7 @@ // And the authenticatable has the correct permissions // But they do not have the appropriate license - $user->givePermissionTo('knowledge_base_status.view-any'); + $user->givePermissionTo('product_admin.view-any'); // They should not be able to access the resource actingAs($user) diff --git a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ViewKnowledgeBaseStatusTest.php b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ViewKnowledgeBaseStatusTest.php index 455049539..30a6c1516 100644 --- a/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ViewKnowledgeBaseStatusTest.php +++ b/app-modules/knowledge-base/tests/KnowledgeBaseStatus/ViewKnowledgeBaseStatusTest.php @@ -60,8 +60,8 @@ ]) )->assertForbidden(); - $user->givePermissionTo('knowledge_base_status.view-any'); - $user->givePermissionTo('knowledge_base_status.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( @@ -80,8 +80,8 @@ $user = User::factory()->licensed(LicenseType::cases())->create(); - $user->givePermissionTo('knowledge_base_status.view-any'); - $user->givePermissionTo('knowledge_base_status.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); $knowledgeBaseStatus = KnowledgeBaseStatus::factory()->create(); diff --git a/app-modules/service-management/src/Policies/ServiceRequestFormPolicy.php b/app-modules/service-management/src/Policies/ServiceRequestFormPolicy.php index fa15cc352..daa099ce8 100644 --- a/app-modules/service-management/src/Policies/ServiceRequestFormPolicy.php +++ b/app-modules/service-management/src/Policies/ServiceRequestFormPolicy.php @@ -66,7 +66,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'service_request_form.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view service request forms.' ); } @@ -74,7 +74,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, ServiceRequestForm $serviceRequestForm): Response { return $authenticatable->canOrElse( - abilities: ['service_request_form.*.view', "service_request_form.{$serviceRequestForm->id}.view"], + abilities: ["product_admin.{$serviceRequestForm->getKey()}.view"], denyResponse: 'You do not have permission to view this service request form.' ); } @@ -82,7 +82,7 @@ public function view(Authenticatable $authenticatable, ServiceRequestForm $servi public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'service_request_form.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create service request forms.' ); } @@ -90,7 +90,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, ServiceRequestForm $serviceRequestForm): Response { return $authenticatable->canOrElse( - abilities: ['service_request_form.*.update', "service_request_form.{$serviceRequestForm->id}.update"], + abilities: ["product_admin.{$serviceRequestForm->getKey()}.update"], denyResponse: 'You do not have permission to update this service request form.' ); } @@ -98,7 +98,7 @@ public function update(Authenticatable $authenticatable, ServiceRequestForm $ser public function delete(Authenticatable $authenticatable, ServiceRequestForm $serviceRequestForm): Response { return $authenticatable->canOrElse( - abilities: ['service_request_form.*.delete', "service_request_form.{$serviceRequestForm->id}.delete"], + abilities: ["product_admin.{$serviceRequestForm->getKey()}.delete"], denyResponse: 'You do not have permission to delete this service request form.' ); } @@ -106,7 +106,7 @@ public function delete(Authenticatable $authenticatable, ServiceRequestForm $ser public function restore(Authenticatable $authenticatable, ServiceRequestForm $serviceRequestForm): Response { return $authenticatable->canOrElse( - abilities: ['service_request_form.*.restore', "service_request_form.{$serviceRequestForm->id}.restore"], + abilities: ["product_admin.{$serviceRequestForm->getKey()}.restore"], denyResponse: 'You do not have permission to restore this service request form.' ); } @@ -114,7 +114,7 @@ public function restore(Authenticatable $authenticatable, ServiceRequestForm $se public function forceDelete(Authenticatable $authenticatable, ServiceRequestForm $serviceRequestForm): Response { return $authenticatable->canOrElse( - abilities: ['service_request_form.*.force-delete', "service_request_form.{$serviceRequestForm->id}.force-delete"], + abilities: ["product_admin.{$serviceRequestForm->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this service request form.' ); } diff --git a/app-modules/service-management/src/Policies/ServiceRequestStatusPolicy.php b/app-modules/service-management/src/Policies/ServiceRequestStatusPolicy.php index 68a2741c6..679ea1c6e 100644 --- a/app-modules/service-management/src/Policies/ServiceRequestStatusPolicy.php +++ b/app-modules/service-management/src/Policies/ServiceRequestStatusPolicy.php @@ -64,7 +64,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'service_request_status.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permissions to view service request statuses.' ); } @@ -72,7 +72,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, ServiceRequestStatus $serviceRequestStatus): Response { return $authenticatable->canOrElse( - abilities: ['service_request_status.*.view', "service_request_status.{$serviceRequestStatus->id}.view"], + abilities: ["product_admin.{$serviceRequestStatus->getKey()}.view"], denyResponse: 'You do not have permissions to view this service request status.' ); } @@ -80,7 +80,7 @@ public function view(Authenticatable $authenticatable, ServiceRequestStatus $ser public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'service_request_status.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permissions to create service request statuses.' ); } @@ -92,7 +92,7 @@ public function update(Authenticatable $authenticatable, ServiceRequestStatus $s } return $authenticatable->canOrElse( - abilities: ['service_request_status.*.update', "service_request_status.{$serviceRequestStatus->id}.update"], + abilities: ["product_admin.{$serviceRequestStatus->getKey()}.update"], denyResponse: 'You do not have permissions to update this service request status.' ); } @@ -104,7 +104,7 @@ public function delete(Authenticatable $authenticatable, ServiceRequestStatus $s } return $authenticatable->canOrElse( - abilities: ['service_request_status.*.delete', "service_request_status.{$serviceRequestStatus->id}.delete"], + abilities: ["product_admin.{$serviceRequestStatus->getKey()}.delete"], denyResponse: 'You do not have permissions to delete this service request status.' ); } @@ -112,7 +112,7 @@ public function delete(Authenticatable $authenticatable, ServiceRequestStatus $s public function restore(Authenticatable $authenticatable, ServiceRequestStatus $serviceRequestStatus): Response { return $authenticatable->canOrElse( - abilities: ['service_request_status.*.restore', "service_request_status.{$serviceRequestStatus->id}.restore"], + abilities: ["product_admin.{$serviceRequestStatus->getKey()}.restore"], denyResponse: 'You do not have permissions to restore this service request status.' ); } @@ -128,7 +128,7 @@ public function forceDelete(Authenticatable $authenticatable, ServiceRequestStat } return $authenticatable->canOrElse( - abilities: ['service_request_status.*.force-delete', "service_request_status.{$serviceRequestStatus->id}.force-delete"], + abilities: ["product_admin.{$serviceRequestStatus->getKey()}.force-delete"], denyResponse: 'You do not have permissions to force delete this service request status.' ); } diff --git a/app-modules/service-management/src/Policies/ServiceRequestTypePolicy.php b/app-modules/service-management/src/Policies/ServiceRequestTypePolicy.php index a3d5341b9..d4a65e267 100644 --- a/app-modules/service-management/src/Policies/ServiceRequestTypePolicy.php +++ b/app-modules/service-management/src/Policies/ServiceRequestTypePolicy.php @@ -64,7 +64,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'service_request_type.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permissions to view service request types.' ); } @@ -72,7 +72,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, ServiceRequestType $serviceRequestType): Response { return $authenticatable->canOrElse( - abilities: ['service_request_type.*.view', "service_request_type.{$serviceRequestType->id}.view"], + abilities: ["product_admin.{$serviceRequestType->getKey()}.view"], denyResponse: 'You do not have permissions to view this service request type.' ); } @@ -80,7 +80,7 @@ public function view(Authenticatable $authenticatable, ServiceRequestType $servi public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'service_request_type.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permissions to create service request types.' ); } @@ -88,7 +88,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, ServiceRequestType $serviceRequestType): Response { return $authenticatable->canOrElse( - abilities: ['service_request_type.*.update', "service_request_type.{$serviceRequestType->id}.update"], + abilities: ["product_admin.{$serviceRequestType->getKey()}.update"], denyResponse: 'You do not have permissions to update this service request type.' ); } @@ -96,7 +96,7 @@ public function update(Authenticatable $authenticatable, ServiceRequestType $ser public function delete(Authenticatable $authenticatable, ServiceRequestType $serviceRequestType): Response { return $authenticatable->canOrElse( - abilities: ['service_request_type.*.delete', "service_request_type.{$serviceRequestType->id}.delete"], + abilities: ["product_admin.{$serviceRequestType->getKey()}.delete"], denyResponse: 'You do not have permissions to delete this service request type.' ); } @@ -104,7 +104,7 @@ public function delete(Authenticatable $authenticatable, ServiceRequestType $ser public function restore(Authenticatable $authenticatable, ServiceRequestType $serviceRequestType): Response { return $authenticatable->canOrElse( - abilities: ['service_request_type.*.restore', "service_request_type.{$serviceRequestType->id}.restore"], + abilities: ["product_admin.{$serviceRequestType->getKey()}.restore"], denyResponse: 'You do not have permissions to restore this service request type.' ); } @@ -116,7 +116,7 @@ public function forceDelete(Authenticatable $authenticatable, ServiceRequestType } return $authenticatable->canOrElse( - abilities: ['service_request_type.*.force-delete', "service_request_type.{$serviceRequestType->id}.force-delete"], + abilities: ["product_admin.{$serviceRequestType->getKey()}.force-delete"], denyResponse: 'You do not have permissions to force delete this service request type.' ); } diff --git a/app-modules/service-management/src/Policies/SlaPolicy.php b/app-modules/service-management/src/Policies/SlaPolicy.php index c4a629cc2..53bc580d8 100644 --- a/app-modules/service-management/src/Policies/SlaPolicy.php +++ b/app-modules/service-management/src/Policies/SlaPolicy.php @@ -64,7 +64,7 @@ public function before(Authenticatable $authenticatable): ?Response public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'sla.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view SLAs.' ); } @@ -72,7 +72,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, Sla $sla): Response { return $authenticatable->canOrElse( - abilities: ['sla.*.view', "sla.{$sla->id}.view"], + abilities: ["product_admin.{$sla->getKey()}.view"], denyResponse: 'You do not have permission to view this SLA.' ); } @@ -80,7 +80,7 @@ public function view(Authenticatable $authenticatable, Sla $sla): Response public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'sla.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create SLAs.' ); } @@ -88,7 +88,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, Sla $sla): Response { return $authenticatable->canOrElse( - abilities: ['sla.*.update', "sla.{$sla->id}.update"], + abilities: ["product_admin.{$sla->getKey()}.update"], denyResponse: 'You do not have permission to update this SLA.' ); } @@ -96,7 +96,7 @@ public function update(Authenticatable $authenticatable, Sla $sla): Response public function delete(Authenticatable $authenticatable, Sla $sla): Response { return $authenticatable->canOrElse( - abilities: ['sla.*.delete', "sla.{$sla->id}.delete"], + abilities: ["product_admin.{$sla->getKey()}.delete"], denyResponse: 'You do not have permission to delete this SLA.' ); } @@ -104,7 +104,7 @@ public function delete(Authenticatable $authenticatable, Sla $sla): Response public function restore(Authenticatable $authenticatable, Sla $sla): Response { return $authenticatable->canOrElse( - abilities: ['sla.*.restore', "sla.{$sla->id}.restore"], + abilities: ["product_admin.{$sla->getKey()}.restore"], denyResponse: 'You do not have permission to restore this SLA.' ); } @@ -112,7 +112,7 @@ public function restore(Authenticatable $authenticatable, Sla $sla): Response public function forceDelete(Authenticatable $authenticatable, Sla $sla): Response { return $authenticatable->canOrElse( - abilities: ['sla.*.force-delete', "sla.{$sla->id}.force-delete"], + abilities: ["product_admin.{$sla->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this SLA.' ); } diff --git a/app-modules/service-management/tests/ServiceRequestStatus/CreateServiceRequestStatusTest.php b/app-modules/service-management/tests/ServiceRequestStatus/CreateServiceRequestStatusTest.php index 33147913b..2a931dd6c 100644 --- a/app-modules/service-management/tests/ServiceRequestStatus/CreateServiceRequestStatusTest.php +++ b/app-modules/service-management/tests/ServiceRequestStatus/CreateServiceRequestStatusTest.php @@ -105,8 +105,8 @@ livewire(CreateServiceRequestStatus::class) ->assertForbidden(); - $user->givePermissionTo('service_request_status.view-any'); - $user->givePermissionTo('service_request_status.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( @@ -134,8 +134,8 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_status.view-any'); - $user->givePermissionTo('service_request_status.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/service-management/tests/ServiceRequestStatus/EditServiceRequestStatusTest.php b/app-modules/service-management/tests/ServiceRequestStatus/EditServiceRequestStatusTest.php index 5a100eee2..ee0a636ef 100644 --- a/app-modules/service-management/tests/ServiceRequestStatus/EditServiceRequestStatusTest.php +++ b/app-modules/service-management/tests/ServiceRequestStatus/EditServiceRequestStatusTest.php @@ -130,8 +130,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('service_request_status.view-any'); - $user->givePermissionTo('service_request_status.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( @@ -161,8 +161,8 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_status.view-any'); - $user->givePermissionTo('service_request_status.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); $serviceRequestStatus = ServiceRequestStatus::factory()->create(); diff --git a/app-modules/service-management/tests/ServiceRequestStatus/ListServiceRequestStatusesTest.php b/app-modules/service-management/tests/ServiceRequestStatus/ListServiceRequestStatusesTest.php index a38311982..b970fc765 100644 --- a/app-modules/service-management/tests/ServiceRequestStatus/ListServiceRequestStatusesTest.php +++ b/app-modules/service-management/tests/ServiceRequestStatus/ListServiceRequestStatusesTest.php @@ -104,7 +104,7 @@ ServiceRequestStatusResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('service_request_status.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -121,7 +121,7 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_status.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( diff --git a/app-modules/service-management/tests/ServiceRequestStatus/ViewServiceRequestStatusTest.php b/app-modules/service-management/tests/ServiceRequestStatus/ViewServiceRequestStatusTest.php index 8727ffdd2..9ff556f8f 100644 --- a/app-modules/service-management/tests/ServiceRequestStatus/ViewServiceRequestStatusTest.php +++ b/app-modules/service-management/tests/ServiceRequestStatus/ViewServiceRequestStatusTest.php @@ -82,8 +82,8 @@ ]) )->assertForbidden(); - $user->givePermissionTo('service_request_status.view-any'); - $user->givePermissionTo('service_request_status.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( @@ -102,8 +102,8 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_status.view-any'); - $user->givePermissionTo('service_request_status.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); $serviceRequestStatus = ServiceRequestStatus::factory()->create(); diff --git a/app-modules/service-management/tests/ServiceRequestType/CreateServiceRequestTypeTest.php b/app-modules/service-management/tests/ServiceRequestType/CreateServiceRequestTypeTest.php index 14c0328e8..63a61d531 100644 --- a/app-modules/service-management/tests/ServiceRequestType/CreateServiceRequestTypeTest.php +++ b/app-modules/service-management/tests/ServiceRequestType/CreateServiceRequestTypeTest.php @@ -102,8 +102,8 @@ livewire(CreateServiceRequestType::class) ->assertForbidden(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( @@ -131,8 +131,8 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.create'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.create'); actingAs($user) ->get( diff --git a/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeAssignmentsTest.php b/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeAssignmentsTest.php index 403678a57..c92745ef4 100644 --- a/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeAssignmentsTest.php +++ b/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeAssignmentsTest.php @@ -156,8 +156,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( @@ -187,8 +187,8 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); $serviceRequestType = ServiceRequestType::factory()->create(); diff --git a/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeTest.php b/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeTest.php index 356d5d6e8..faefe60a4 100644 --- a/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeTest.php +++ b/app-modules/service-management/tests/ServiceRequestType/EditServiceRequestTypeTest.php @@ -121,8 +121,8 @@ ]) ->assertForbidden(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); actingAs($user) ->get( @@ -152,8 +152,8 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.*.update'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.update'); $serviceRequestType = ServiceRequestType::factory()->create(); diff --git a/app-modules/service-management/tests/ServiceRequestType/ListServiceRequestTypeTest.php b/app-modules/service-management/tests/ServiceRequestType/ListServiceRequestTypeTest.php index e3900ecf3..8aaf9396f 100644 --- a/app-modules/service-management/tests/ServiceRequestType/ListServiceRequestTypeTest.php +++ b/app-modules/service-management/tests/ServiceRequestType/ListServiceRequestTypeTest.php @@ -92,7 +92,7 @@ ServiceRequestTypeResource::getUrl('index') )->assertForbidden(); - $user->givePermissionTo('service_request_type.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( @@ -109,7 +109,7 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_type.view-any'); + $user->givePermissionTo('product_admin.view-any'); actingAs($user) ->get( diff --git a/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeAuditorsTest.php b/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeAuditorsTest.php index b4a73f3f8..71c165037 100644 --- a/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeAuditorsTest.php +++ b/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeAuditorsTest.php @@ -60,7 +60,7 @@ ]) )->assertForbidden(); - $user->givePermissionTo('service_request_type.view-any'); + $user->givePermissionTo('product_admin.view-any'); $user->givePermissionTo('team.view-any'); livewire(ManageServiceRequestTypeAuditors::class, [ diff --git a/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeManagersTest.php b/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeManagersTest.php index ca10a45bc..738ee9a08 100644 --- a/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeManagersTest.php +++ b/app-modules/service-management/tests/ServiceRequestType/ServiceRequestTypeManagersTest.php @@ -60,7 +60,7 @@ ]) )->assertForbidden(); - $user->givePermissionTo('service_request_type.view-any'); + $user->givePermissionTo('product_admin.view-any'); $user->givePermissionTo('team.view-any'); livewire(ManageServiceRequestTypeManagers::class, [ diff --git a/app-modules/service-management/tests/ServiceRequestType/ViewServiceRequestTypeTest.php b/app-modules/service-management/tests/ServiceRequestType/ViewServiceRequestTypeTest.php index 654f9aa1d..0fd8c7df7 100644 --- a/app-modules/service-management/tests/ServiceRequestType/ViewServiceRequestTypeTest.php +++ b/app-modules/service-management/tests/ServiceRequestType/ViewServiceRequestTypeTest.php @@ -78,8 +78,8 @@ ]) )->assertForbidden(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); actingAs($user) ->get( @@ -98,8 +98,8 @@ $user = User::factory()->licensed([Contact::getLicenseType()])->create(); - $user->givePermissionTo('service_request_type.view-any'); - $user->givePermissionTo('service_request_type.*.view'); + $user->givePermissionTo('product_admin.view-any'); + $user->givePermissionTo('product_admin.*.view'); $serviceRequestType = ServiceRequestType::factory()->create(); diff --git a/app-modules/team/src/Filament/Resources/TeamResource.php b/app-modules/team/src/Filament/Resources/TeamResource.php index bdc83a8db..356469fee 100644 --- a/app-modules/team/src/Filament/Resources/TeamResource.php +++ b/app-modules/team/src/Filament/Resources/TeamResource.php @@ -38,7 +38,6 @@ use AidingApp\Team\Models\Team; use Filament\Resources\Resource; -use App\Filament\Clusters\UserManagement; use AidingApp\Team\Filament\Resources\TeamResource\Pages\EditTeam; use AidingApp\Team\Filament\Resources\TeamResource\Pages\ViewTeam; use AidingApp\Team\Filament\Resources\TeamResource\Pages\ListTeams; @@ -49,9 +48,7 @@ class TeamResource extends Resource { protected static ?string $model = Team::class; - protected static ?string $navigationIcon = 'heroicon-o-user-group'; - - protected static ?string $cluster = UserManagement::class; + protected static ?string $navigationGroup = 'People Administration'; protected static ?int $navigationSort = 20; diff --git a/app/Filament/Clusters/UserManagement.php b/app/Filament/Clusters/UserManagement.php deleted file mode 100644 index f10ce6a11..000000000 --- a/app/Filament/Clusters/UserManagement.php +++ /dev/null @@ -1,50 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace App\Filament\Clusters; - -use Filament\Clusters\Cluster; - -class UserManagement extends Cluster -{ - protected static ?string $navigationIcon = 'heroicon-o-squares-2x2'; - - protected static ?string $navigationGroup = 'Product Administration'; - - protected static ?string $navigationLabel = 'User Management'; - - protected static ?int $navigationSort = 1; -} diff --git a/app/Filament/Resources/SystemUserResource.php b/app/Filament/Resources/SystemUserResource.php index 569941c42..229ce8527 100644 --- a/app/Filament/Resources/SystemUserResource.php +++ b/app/Filament/Resources/SystemUserResource.php @@ -38,7 +38,6 @@ use App\Models\SystemUser; use Filament\Resources\Resource; -use App\Filament\Clusters\UserManagement; use App\Filament\Resources\SystemUserResource\Pages\EditSystemUser; use App\Filament\Resources\SystemUserResource\Pages\ListSystemUsers; use App\Filament\Resources\SystemUserResource\Pages\CreateSystemUser; @@ -48,9 +47,7 @@ class SystemUserResource extends Resource { protected static ?string $model = SystemUser::class; - protected static ?string $navigationIcon = 'heroicon-o-wrench-screwdriver'; - - protected static ?string $cluster = UserManagement::class; + protected static ?string $navigationGroup = 'People Administration'; protected static ?string $navigationLabel = 'Programmatic Users'; diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php index bc8153737..073c50932 100644 --- a/app/Filament/Resources/UserResource.php +++ b/app/Filament/Resources/UserResource.php @@ -47,7 +47,6 @@ use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; use Filament\Forms\Components\TextInput; -use App\Filament\Clusters\UserManagement; use App\Filament\Tables\Columns\IdColumn; use AidingApp\Authorization\Models\License; use App\Filament\Forms\Components\Licenses; @@ -65,9 +64,7 @@ class UserResource extends Resource { protected static ?string $model = User::class; - protected static ?string $navigationIcon = 'heroicon-o-users'; - - protected static ?string $cluster = UserManagement::class; + protected static ?string $navigationGroup = 'People Administration'; protected static ?int $navigationSort = 10; diff --git a/app/Policies/NotificationSettingPolicy.php b/app/Policies/NotificationSettingPolicy.php index a836ef7d5..6f42e030f 100644 --- a/app/Policies/NotificationSettingPolicy.php +++ b/app/Policies/NotificationSettingPolicy.php @@ -45,7 +45,7 @@ class NotificationSettingPolicy public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'notification_setting.view-any', + abilities: 'product_admin.view-any', denyResponse: 'You do not have permission to view notification settings.' ); } @@ -53,7 +53,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, NotificationSetting $notificationSetting): Response { return $authenticatable->canOrElse( - abilities: ['notification_setting.*.view', "notification_setting.{$notificationSetting->id}.view"], + abilities: ["product_admin.{$notificationSetting->getkey()}.view"], denyResponse: 'You do not have permission to view this notification setting.' ); } @@ -61,7 +61,7 @@ public function view(Authenticatable $authenticatable, NotificationSetting $noti public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'notification_setting.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create notification settings.' ); } @@ -69,7 +69,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, NotificationSetting $notificationSetting): Response { return $authenticatable->canOrElse( - abilities: ['notification_setting.*.update', "notification_setting.{$notificationSetting->id}.update"], + abilities: ["product_admin.{$notificationSetting->getKey()}.update"], denyResponse: 'You do not have permission to update this notification setting.' ); } @@ -77,7 +77,7 @@ public function update(Authenticatable $authenticatable, NotificationSetting $no public function delete(Authenticatable $authenticatable, NotificationSetting $notificationSetting): Response { return $authenticatable->canOrElse( - abilities: ['notification_setting.*.delete', "notification_setting.{$notificationSetting->id}.delete"], + abilities: ["product_admin.{$notificationSetting->getKey()}.delete"], denyResponse: 'You do not have permission to delete this notification setting.' ); } @@ -85,7 +85,7 @@ public function delete(Authenticatable $authenticatable, NotificationSetting $no public function restore(Authenticatable $authenticatable, NotificationSetting $notificationSetting): Response { return $authenticatable->canOrElse( - abilities: ['notification_setting.*.restore', "notification_setting.{$notificationSetting->id}.restore"], + abilities: ["product_admin.{$notificationSetting->getKey()}.restore"], denyResponse: 'You do not have permission to restore this notification setting.' ); } @@ -93,7 +93,7 @@ public function restore(Authenticatable $authenticatable, NotificationSetting $n public function forceDelete(Authenticatable $authenticatable, NotificationSetting $notificationSetting): Response { return $authenticatable->canOrElse( - abilities: ['notification_setting.*.force-delete', "notification_setting.{$notificationSetting->id}.force-delete"], + abilities: ["product_admin.{$notificationSetting->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this notification setting.' ); } diff --git a/app/Policies/PronounsPolicy.php b/app/Policies/PronounsPolicy.php index 9dbd5ef81..eb8449825 100644 --- a/app/Policies/PronounsPolicy.php +++ b/app/Policies/PronounsPolicy.php @@ -45,7 +45,7 @@ class PronounsPolicy public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: ['pronouns.view-any'], + abilities: ['product_admin.view-any'], denyResponse: 'You do not have permission to view pronouns.' ); } @@ -53,7 +53,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, Pronouns $model): Response { return $authenticatable->canOrElse( - abilities: ['pronouns.*.view', "pronouns.{$model->id}.view"], + abilities: ["product_admin.{$model->getKey()}.view"], denyResponse: 'You do not have permission to view these pronouns.' ); } @@ -61,7 +61,7 @@ public function view(Authenticatable $authenticatable, Pronouns $model): Respons public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'pronouns.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create pronouns.' ); } @@ -69,7 +69,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, Pronouns $model): Response { return $authenticatable->canOrElse( - abilities: ['pronouns.*.update', "pronouns.{$model->id}.update"], + abilities: ["product_admin.{$model->getKey()}.update"], denyResponse: 'You do not have permission to update these pronouns.' ); } @@ -77,7 +77,7 @@ public function update(Authenticatable $authenticatable, Pronouns $model): Respo public function delete(Authenticatable $authenticatable, Pronouns $model): Response { return $authenticatable->canOrElse( - abilities: ['pronouns.*.delete', "pronouns.{$model->id}.delete"], + abilities: ["product_admin.{$model->getKey()}.delete"], denyResponse: 'You do not have permission to delete these pronouns.' ); } @@ -85,7 +85,7 @@ public function delete(Authenticatable $authenticatable, Pronouns $model): Respo public function restore(Authenticatable $authenticatable, Pronouns $model): Response { return $authenticatable->canOrElse( - abilities: ['pronouns.*.restore', "pronouns.{$model->id}.restore"], + abilities: ["product_admin.{$model->getKey()}.restore"], denyResponse: 'You do not have permission to restore these pronouns.' ); } @@ -93,7 +93,7 @@ public function restore(Authenticatable $authenticatable, Pronouns $model): Resp public function forceDelete(Authenticatable $authenticatable, Pronouns $model): Response { return $authenticatable->canOrElse( - abilities: ['pronouns.*.force-delete', "pronouns.{$model->id}.force-delete"], + abilities: ["product_admin.{$model->getkey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete these pronouns.' ); } diff --git a/app/Policies/TagPolicy.php b/app/Policies/TagPolicy.php index 22590f539..9ee77b7e9 100644 --- a/app/Policies/TagPolicy.php +++ b/app/Policies/TagPolicy.php @@ -45,7 +45,7 @@ class TagPolicy public function viewAny(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: ['tag.view-any'], + abilities: ['product_admin.view-any'], denyResponse: 'You do not have permission to view tags.' ); } @@ -53,7 +53,7 @@ public function viewAny(Authenticatable $authenticatable): Response public function view(Authenticatable $authenticatable, Tag $tag): Response { return $authenticatable->canOrElse( - abilities: ['tag.*.view', "tag.{$tag->id}.view"], + abilities: ["product_admin.{$tag->getKey()}.view"], denyResponse: 'You do not have permission to view this tag.' ); } @@ -61,7 +61,7 @@ public function view(Authenticatable $authenticatable, Tag $tag): Response public function create(Authenticatable $authenticatable): Response { return $authenticatable->canOrElse( - abilities: 'tag.create', + abilities: 'product_admin.create', denyResponse: 'You do not have permission to create tags.' ); } @@ -69,7 +69,7 @@ public function create(Authenticatable $authenticatable): Response public function update(Authenticatable $authenticatable, Tag $tag): Response { return $authenticatable->canOrElse( - abilities: ['tag.*.update', "tag.{$tag->id}.update"], + abilities: ["product_admin.{$tag->getKey()}.update"], denyResponse: 'You do not have permission to update this tag.' ); } @@ -77,7 +77,7 @@ public function update(Authenticatable $authenticatable, Tag $tag): Response public function delete(Authenticatable $authenticatable, Tag $tag): Response { return $authenticatable->canOrElse( - abilities: ['tag.*.delete', "tag.{$tag->id}.delete"], + abilities: ["product_admin.{$tag->getKey()}.delete"], denyResponse: 'You do not have permission to delete this tag.' ); } @@ -85,7 +85,7 @@ public function delete(Authenticatable $authenticatable, Tag $tag): Response public function restore(Authenticatable $authenticatable, Tag $tag): Response { return $authenticatable->canOrElse( - abilities: ['tag.*.restore', "tag.{$tag->id}.restore"], + abilities: ["product_admin.{$tag->getKey()}.restore"], denyResponse: 'You do not have permission to restore this tag.' ); } @@ -93,7 +93,7 @@ public function restore(Authenticatable $authenticatable, Tag $tag): Response public function forceDelete(Authenticatable $authenticatable, Tag $tag): Response { return $authenticatable->canOrElse( - abilities: ['tag.*.force-delete', "tag.{$tag->id}.force-delete"], + abilities: ["product_admin.{$tag->getKey()}.force-delete"], denyResponse: 'You do not have permission to permanently delete this tag.' ); } diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index c1db4b0a6..337cb47e8 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -157,6 +157,10 @@ public function panel(Panel $panel): Panel ->label('Premium Features') ->icon('heroicon-o-rocket-launch') ->collapsed(), + NavigationGroup::make() + ->label('People Administration') + ->icon('heroicon-o-users') + ->collapsed(), NavigationGroup::make() ->label('Product Administration') ->icon('heroicon-o-wrench-screwdriver') diff --git a/database/migrations/2024_12_09_162908_seed_permissions_delete_unused_product_administration_permissions.php b/database/migrations/2024_12_09_162908_seed_permissions_delete_unused_product_administration_permissions.php new file mode 100644 index 000000000..49b81521e --- /dev/null +++ b/database/migrations/2024_12_09_162908_seed_permissions_delete_unused_product_administration_permissions.php @@ -0,0 +1,183 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Aiding App™ is licensed under the Elastic License 2.0. For more details, + see + + Notice: + + - You may not provide the software to third parties as a hosted or managed + service, where the service provides users with access to any substantial set of + the features or functionality of the software. + - You may not move, change, disable, or circumvent the license key functionality + in the software, and you may not remove or obscure any functionality in the + software that is protected by the license key. + - You may not alter, remove, or obscure any licensing, copyright, or other notices + of the licensor in the software. Any use of the licensor’s trademarks is subject + to applicable law. + - Canyon GBS LLC respects the intellectual property rights of others and expects the + same in return. Canyon GBS™ and Aiding App™ are registered trademarks of + Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks + vigorously. + - The software solution, including services, infrastructure, and code, is offered as a + Software as a Service (SaaS) by Canyon GBS LLC. + - Use of this software implies agreement to the license terms and conditions as stated + in the Elastic License 2.0. + + For more information or inquiries please visit our website at + or contact us via email at legal@canyongbs.com. + + +*/ + +use Illuminate\Support\Arr; +use Illuminate\Support\Facades\DB; +use Illuminate\Database\Migrations\Migration; +use Database\Migrations\Concerns\CanModifyPermissions; + +return new class () extends Migration { + use CanModifyPermissions; + + private array $permissions = [ + 'contact_status.view-any' => 'Contact Status', + 'contact_status.create' => 'Contact Status', + 'contact_status.*.view' => 'Contact Status', + 'contact_status.*.update' => 'Contact Status', + 'contact_status.*.delete' => 'Contact Status', + 'contact_status.*.restore' => 'Contact Status', + 'contact_status.*.force-delete' => 'Contact Status', + 'contact_source.view-any' => 'Contact Source', + 'contact_source.create' => 'Contact Source', + 'contact_source.*.view' => 'Contact Source', + 'contact_source.*.update' => 'Contact Source', + 'contact_source.*.delete' => 'Contact Source', + 'contact_source.*.restore' => 'Contact Source', + 'contact_source.*.force-delete' => 'Contact Source', + 'organization_type.view-any' => 'Organization Type', + 'organization_type.create' => 'Organization Type', + 'organization_type.*.view' => 'Organization Type', + 'organization_type.*.update' => 'Organization Type', + 'organization_type.*.delete' => 'Organization Type', + 'organization_type.*.restore' => 'Organization Type', + 'organization_type.*.force-delete' => 'Organization Type', + 'organization_industry.view-any' => 'Organization Industry', + 'organization_industry.create' => 'Organization Industry', + 'organization_industry.*.view' => 'Organization Industry', + 'organization_industry.*.update' => 'Organization Industry', + 'organization_industry.*.delete' => 'Organization Industry', + 'organization_industry.*.restore' => 'Organization Industry', + 'organization_industry.*.force-delete' => 'Organization Industry', + 'service_request_type.view-any' => 'Service Request Type', + 'service_request_type.create' => 'Service Request Type', + 'service_request_type.*.view' => 'Service Request Type', + 'service_request_type.*.update' => 'Service Request Type', + 'service_request_type.*.delete' => 'Service Request Type', + 'service_request_type.*.restore' => 'Service Request Type', + 'service_request_type.*.force-delete' => 'Service Request Type', + 'service_request_status.view-any' => 'Service Request Status', + 'service_request_status.create' => 'Service Request Status', + 'service_request_status.*.view' => 'Service Request Status', + 'service_request_status.*.update' => 'Service Request Status', + 'service_request_status.*.delete' => 'Service Request Status', + 'service_request_status.*.restore' => 'Service Request Status', + 'service_request_status.*.force-delete' => 'Service Request Status', + 'service_request_form.view-any' => 'Service Request Form', + 'service_request_form.create' => 'Service Request Form', + 'service_request_form.*.view' => 'Service Request Form', + 'service_request_form.*.update' => 'Service Request Form', + 'service_request_form.*.delete' => 'Service Request Form', + 'service_request_form.*.restore' => 'Service Request Form', + 'service_request_form.*.force-delete' => 'Service Request Form', + 'sla.view-any' => 'SLA', + 'sla.create' => 'SLA', + 'sla.*.view' => 'SLA', + 'sla.*.update' => 'SLA', + 'sla.*.delete' => 'SLA', + 'sla.*.restore' => 'SLA', + 'sla.*.force-delete' => 'SLA', + 'knowledge_base_category.view-any' => 'Knowledge Base Category', + 'knowledge_base_category.create' => 'Knowledge Base Category', + 'knowledge_base_category.*.view' => 'Knowledge Base Category', + 'knowledge_base_category.*.update' => 'Knowledge Base Category', + 'knowledge_base_category.*.delete' => 'Knowledge Base Category', + 'knowledge_base_category.*.restore' => 'Knowledge Base Category', + 'knowledge_base_category.*.force-delete' => 'Knowledge Base Category', + 'knowledge_base_quality.view-any' => 'Knowledge Base Quality', + 'knowledge_base_quality.create' => 'Knowledge Base Quality', + 'knowledge_base_quality.*.view' => 'Knowledge Base Quality', + 'knowledge_base_quality.*.update' => 'Knowledge Base Quality', + 'knowledge_base_quality.*.delete' => 'Knowledge Base Quality', + 'knowledge_base_quality.*.restore' => 'Knowledge Base Quality', + 'knowledge_base_quality.*.force-delete' => 'Knowledge Base Quality', + 'knowledge_base_status.view-any' => 'Knowledge Base Status', + 'knowledge_base_status.create' => 'Knowledge Base Status', + 'knowledge_base_status.*.view' => 'Knowledge Base Status', + 'knowledge_base_status.*.update' => 'Knowledge Base Status', + 'knowledge_base_status.*.delete' => 'Knowledge Base Status', + 'knowledge_base_status.*.restore' => 'Knowledge Base Status', + 'knowledge_base_status.*.force-delete' => 'Knowledge Base Status', + 'tag.view-any' => 'Tag', + 'tag.create' => 'Tag', + 'tag.*.view' => 'Tag', + 'tag.*.update' => 'Tag', + 'tag.*.delete' => 'Tag', + 'tag.*.restore' => 'Tag', + 'tag.*.force-delete' => 'Tag', + 'pronouns.view-any' => 'Pronouns', + 'pronouns.create' => 'Pronouns', + 'pronouns.*.view' => 'Pronouns', + 'pronouns.*.update' => 'Pronouns', + 'pronouns.*.delete' => 'Pronouns', + 'pronouns.*.restore' => 'Pronouns', + 'pronouns.*.force-delete' => 'Pronouns', + 'notification_setting.view-any' => 'Notification Setting', + 'notification_setting.create' => 'Notification Setting', + 'notification_setting.*.view' => 'Notification Setting', + 'notification_setting.*.update' => 'Notification Setting', + 'notification_setting.*.delete' => 'Notification Setting', + 'notification_setting.*.restore' => 'Notification Setting', + 'notification_setting.*.force-delete' => 'Notification Setting', + 'email_template.view-any' => 'Email Template', + 'email_template.create' => 'Email Template', + 'email_template.*.view' => 'Email Template', + 'email_template.*.update' => 'Email Template', + 'email_template.*.delete' => 'Email Template', + 'email_template.*.restore' => 'Email Template', + 'email_template.*.force-delete' => 'Email Template', + 'sms_template.view-any' => 'SMS Template', + 'sms_template.create' => 'SMS Template', + 'sms_template.*.view' => 'SMS Template', + 'sms_template.*.update' => 'SMS Template', + 'sms_template.*.delete' => 'SMS Template', + 'sms_template.*.restore' => 'SMS Template', + 'sms_template.*.force-delete' => 'SMS Template', + ]; + + private array $guards = [ + 'web', + 'api', + ]; + + public function up(): void + { + collect($this->guards) + ->each(fn (string $guard) => $this->deletePermissions(array_keys($this->permissions), $guard)); + } + + public function down(): void + { + collect($this->guards) + ->each(function (string $guard) { + $permissions = Arr::except($this->permissions, keys: DB::table('permissions') + ->where('guard_name', $guard) + ->pluck('name') + ->all()); + + $this->createPermissions($permissions, $guard); + }); + } +};