Files
InvoiceShelf/config/abilities.php
mchev 3259173066 Laravel 11 (#84)
* Convert string references to `::class`

PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP.

* Use Faker methods

Accessing Faker properties was deprecated in Faker 1.14.

* Convert route options to fluent methods

Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.

* Adopt class based routes

* Remove default `app` files

* Shift core files

* Streamline config files

* Set new `ENV` variables

* Default new `bootstrap/app.php`

* Re-register HTTP middleware

* Consolidate service providers

* Re-register service providers

* Re-register routes

* Re-register scheduled commands

* Bump Composer dependencies

* Use `<env>` tags for configuration

`<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI.

Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/

* Adopt anonymous migrations

* Rename `password_resets` table

* Convert `$casts` property to method

* Adopt Laravel type hints

* Mark base controller as `abstract`

* Remove `CreatesApplication` testing trait

* Shift cleanup

* Fix shift first issues

* Updating Rules for laravel 11, sanctum config and pint

* Fix Carbon issue on dashboard

* Temporary fix for tests while migration is issue fixed on laravel side

* Carbon needs numerical values, not strings

* Minimum php version

* Fix domain installation step not fetching the correct company_id

* Fix Role Policy wasn't properly registered

---------
2024-06-05 11:33:52 +02:00

421 lines
12 KiB
PHP

<?php
use App\Models\Customer;
use App\Models\CustomField;
use App\Models\Estimate;
use App\Models\ExchangeRateProvider;
use App\Models\Expense;
use App\Models\Invoice;
use App\Models\Item;
use App\Models\Note;
use App\Models\Payment;
use App\Models\RecurringInvoice;
use App\Models\TaxType;
return [
'abilities' => [
// Customer
[
'name' => 'view customer',
'ability' => 'view-customer',
'model' => Customer::class,
],
[
'name' => 'create customer',
'ability' => 'create-customer',
'model' => Customer::class,
'depends_on' => [
'view-customer',
'view-custom-field',
],
],
[
'name' => 'edit customer',
'ability' => 'edit-customer',
'model' => Customer::class,
'depends_on' => [
'view-customer',
'view-custom-field',
],
],
[
'name' => 'delete customer',
'ability' => 'delete-customer',
'model' => Customer::class,
'depends_on' => [
'view-customer',
],
],
// Item
[
'name' => 'view item',
'ability' => 'view-item',
'model' => Item::class,
],
[
'name' => 'create item',
'ability' => 'create-item',
'model' => Item::class,
'depends_on' => [
'view-item',
'view-tax-type',
],
],
[
'name' => 'edit item',
'ability' => 'edit-item',
'model' => Item::class,
'depends_on' => [
'view-item',
],
],
[
'name' => 'delete item',
'ability' => 'delete-item',
'model' => Item::class,
'depends_on' => [
'view-item',
],
],
// Tax Type
[
'name' => 'view tax type',
'ability' => 'view-tax-type',
'model' => TaxType::class,
],
[
'name' => 'create tax type',
'ability' => 'create-tax-type',
'model' => TaxType::class,
'depends_on' => [
'view-tax-type',
],
],
[
'name' => 'edit tax type',
'ability' => 'edit-tax-type',
'model' => TaxType::class,
'depends_on' => [
'view-tax-type',
],
],
[
'name' => 'delete tax type',
'ability' => 'delete-tax-type',
'model' => TaxType::class,
'depends_on' => [
'view-tax-type',
],
],
// Estimate
[
'name' => 'view estimate',
'ability' => 'view-estimate',
'model' => Estimate::class,
],
[
'name' => 'create estimate',
'ability' => 'create-estimate',
'model' => Estimate::class,
'depends_on' => [
'view-estimate',
'view-item',
'view-tax-type',
'view-customer',
'view-custom-field',
'view-all-notes',
],
],
[
'name' => 'edit estimate',
'ability' => 'edit-estimate',
'model' => Estimate::class,
'depends_on' => [
'view-item',
'view-estimate',
'view-tax-type',
'view-customer',
'view-custom-field',
'view-all-notes',
],
],
[
'name' => 'delete estimate',
'ability' => 'delete-estimate',
'model' => Estimate::class,
'depends_on' => [
'view-estimate',
],
],
[
'name' => 'send estimate',
'ability' => 'send-estimate',
'model' => Estimate::class,
],
// Invoice
[
'name' => 'view invoice',
'ability' => 'view-invoice',
'model' => Invoice::class,
],
[
'name' => 'create invoice',
'ability' => 'create-invoice',
'model' => Invoice::class,
'owner_only' => false,
'depends_on' => [
'view-item',
'view-invoice',
'view-tax-type',
'view-customer',
'view-custom-field',
'view-all-notes',
],
],
[
'name' => 'edit invoice',
'ability' => 'edit-invoice',
'model' => Invoice::class,
'depends_on' => [
'view-item',
'view-invoice',
'view-tax-type',
'view-customer',
'view-custom-field',
'view-all-notes',
],
],
[
'name' => 'delete invoice',
'ability' => 'delete-invoice',
'model' => Invoice::class,
'depends_on' => [
'view-invoice',
],
],
[
'name' => 'send invoice',
'ability' => 'send-invoice',
'model' => Invoice::class,
],
// Recurring Invoice
[
'name' => 'view recurring invoice',
'ability' => 'view-recurring-invoice',
'model' => RecurringInvoice::class,
],
[
'name' => 'create recurring invoice',
'ability' => 'create-recurring-invoice',
'model' => RecurringInvoice::class,
'depends_on' => [
'view-item',
'view-recurring-invoice',
'view-tax-type',
'view-customer',
'view-all-notes',
'send-invoice',
],
],
[
'name' => 'edit recurring invoice',
'ability' => 'edit-recurring-invoice',
'model' => RecurringInvoice::class,
'depends_on' => [
'view-item',
'view-recurring-invoice',
'view-tax-type',
'view-customer',
'view-all-notes',
'send-invoice',
],
],
[
'name' => 'delete recurring invoice',
'ability' => 'delete-recurring-invoice',
'model' => RecurringInvoice::class,
'depends_on' => [
'view-recurring-invoice',
],
],
// Payment
[
'name' => 'view payment',
'ability' => 'view-payment',
'model' => Payment::class,
],
[
'name' => 'create payment',
'ability' => 'create-payment',
'model' => Payment::class,
'depends_on' => [
'view-customer',
'view-payment',
'view-invoice',
'view-custom-field',
'view-all-notes',
],
],
[
'name' => 'edit payment',
'ability' => 'edit-payment',
'model' => Payment::class,
'depends_on' => [
'view-customer',
'view-payment',
'view-invoice',
'view-custom-field',
'view-all-notes',
],
],
[
'name' => 'delete payment',
'ability' => 'delete-payment',
'model' => Payment::class,
'depends_on' => [
'view-payment',
],
],
[
'name' => 'send payment',
'ability' => 'send-payment',
'model' => Payment::class,
],
// Expense
[
'name' => 'view expense',
'ability' => 'view-expense',
'model' => Expense::class,
],
[
'name' => 'create expense',
'ability' => 'create-expense',
'model' => Expense::class,
'depends_on' => [
'view-customer',
'view-expense',
'view-custom-field',
],
],
[
'name' => 'edit expense',
'ability' => 'edit-expense',
'model' => Expense::class,
'depends_on' => [
'view-customer',
'view-expense',
'view-custom-field',
],
],
[
'name' => 'delete expense',
'ability' => 'delete-expense',
'model' => Expense::class,
'depends_on' => [
'view-expense',
],
],
// Custom Field
[
'name' => 'view custom field',
'ability' => 'view-custom-field',
'model' => CustomField::class,
],
[
'name' => 'create custom field',
'ability' => 'create-custom-field',
'model' => CustomField::class,
'depends_on' => [
'view-custom-field',
],
],
[
'name' => 'edit custom field',
'ability' => 'edit-custom-field',
'model' => CustomField::class,
'depends_on' => [
'view-custom-field',
],
],
[
'name' => 'delete custom field',
'ability' => 'delete-custom-field',
'model' => CustomField::class,
'depends_on' => [
'view-custom-field',
],
],
// Financial Reports
[
'name' => 'view financial reports',
'ability' => 'view-financial-reports',
'model' => null,
],
// Exchange Rate Provider
[
'name' => 'view exchange rate provider',
'ability' => 'view-exchange-rate-provider',
'model' => ExchangeRateProvider::class,
'owner_only' => false,
],
[
'name' => 'create exchange rate provider',
'ability' => 'create-exchange-rate-provider',
'model' => ExchangeRateProvider::class,
'owner_only' => false,
'depends_on' => [
'view-exchange-rate-provider',
],
],
[
'name' => 'edit exchange rate provider',
'ability' => 'edit-exchange-rate-provider',
'model' => ExchangeRateProvider::class,
'owner_only' => false,
'depends_on' => [
'view-exchange-rate-provider',
],
],
[
'name' => 'delete exchange rate provider',
'ability' => 'delete-exchange-rate-provider',
'model' => ExchangeRateProvider::class,
'owner_only' => false,
'depends_on' => [
'view-exchange-rate-provider',
],
],
// Settings
[
'name' => 'view company dashboard',
'ability' => 'dashboard',
'model' => null,
],
[
'name' => 'view all notes',
'ability' => 'view-all-notes',
'model' => Note::class,
],
[
'name' => 'manage notes',
'ability' => 'manage-all-notes',
'model' => Note::class,
'depends_on' => [
'view-all-notes',
],
],
],
];