2018-10-04 19:10:43 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2018-10-04 19:10:43 +02:00
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2019-09-27 06:31:13 +02:00
|
|
|
use App\Models\Activity;
|
2021-03-25 11:55:59 +01:00
|
|
|
use App\Models\Subscription;
|
2019-01-16 10:28:06 +01:00
|
|
|
use App\Models\Client;
|
2019-06-20 08:20:14 +02:00
|
|
|
use App\Models\Company;
|
2019-10-05 00:58:51 +02:00
|
|
|
use App\Models\CompanyGateway;
|
2020-04-09 12:48:04 +02:00
|
|
|
use App\Models\CompanyToken;
|
2020-01-30 04:02:25 +01:00
|
|
|
use App\Models\Credit;
|
2020-02-28 22:57:47 +01:00
|
|
|
use App\Models\Design;
|
2020-06-23 13:05:41 +02:00
|
|
|
use App\Models\Document;
|
2020-01-20 02:31:58 +01:00
|
|
|
use App\Models\Expense;
|
2020-10-13 06:08:56 +02:00
|
|
|
use App\Models\ExpenseCategory;
|
2019-10-05 00:58:51 +02:00
|
|
|
use App\Models\GroupSetting;
|
2019-04-15 02:10:54 +02:00
|
|
|
use App\Models\Invoice;
|
2019-05-03 09:57:55 +02:00
|
|
|
use App\Models\Payment;
|
2020-05-26 10:20:50 +02:00
|
|
|
use App\Models\PaymentTerm;
|
2019-04-03 03:17:21 +02:00
|
|
|
use App\Models\Product;
|
2020-10-08 00:25:39 +02:00
|
|
|
use App\Models\Project;
|
2019-05-02 13:07:38 +02:00
|
|
|
use App\Models\Quote;
|
2019-05-03 00:29:04 +02:00
|
|
|
use App\Models\RecurringInvoice;
|
2019-05-05 02:49:01 +02:00
|
|
|
use App\Models\RecurringQuote;
|
2020-10-12 22:42:02 +02:00
|
|
|
use App\Models\Task;
|
2020-10-20 01:01:59 +02:00
|
|
|
use App\Models\TaskStatus;
|
2019-10-30 03:41:18 +01:00
|
|
|
use App\Models\TaxRate;
|
2019-04-27 11:20:03 +02:00
|
|
|
use App\Models\User;
|
2020-01-20 02:31:58 +01:00
|
|
|
use App\Models\Vendor;
|
2020-07-06 13:22:36 +02:00
|
|
|
use App\Models\Webhook;
|
2019-09-27 06:31:13 +02:00
|
|
|
use App\Policies\ActivityPolicy;
|
2021-03-25 11:55:59 +01:00
|
|
|
use App\Policies\SubscriptionPolicy;
|
2019-01-16 10:28:06 +01:00
|
|
|
use App\Policies\ClientPolicy;
|
2021-03-10 01:08:58 +01:00
|
|
|
use App\Policies\ClientSubscriptionPolicy;
|
2019-10-05 00:58:51 +02:00
|
|
|
use App\Policies\CompanyGatewayPolicy;
|
2019-06-20 08:20:14 +02:00
|
|
|
use App\Policies\CompanyPolicy;
|
2020-04-09 12:48:04 +02:00
|
|
|
use App\Policies\CompanyTokenPolicy;
|
2020-01-30 04:02:25 +01:00
|
|
|
use App\Policies\CreditPolicy;
|
2020-02-28 22:57:47 +01:00
|
|
|
use App\Policies\DesignPolicy;
|
2020-06-23 13:05:41 +02:00
|
|
|
use App\Policies\DocumentPolicy;
|
2020-10-13 06:08:56 +02:00
|
|
|
use App\Policies\ExpenseCategoryPolicy;
|
2020-01-20 02:31:58 +01:00
|
|
|
use App\Policies\ExpensePolicy;
|
2019-10-05 00:58:51 +02:00
|
|
|
use App\Policies\GroupSettingPolicy;
|
2019-04-15 02:10:54 +02:00
|
|
|
use App\Policies\InvoicePolicy;
|
2019-05-03 09:57:55 +02:00
|
|
|
use App\Policies\PaymentPolicy;
|
2020-05-26 10:20:50 +02:00
|
|
|
use App\Policies\PaymentTermPolicy;
|
2019-04-03 03:17:21 +02:00
|
|
|
use App\Policies\ProductPolicy;
|
2020-10-08 00:25:39 +02:00
|
|
|
use App\Policies\ProjectPolicy;
|
2019-05-02 13:07:38 +02:00
|
|
|
use App\Policies\QuotePolicy;
|
2019-05-03 00:29:04 +02:00
|
|
|
use App\Policies\RecurringInvoicePolicy;
|
2019-05-05 02:49:01 +02:00
|
|
|
use App\Policies\RecurringQuotePolicy;
|
2020-10-12 22:42:02 +02:00
|
|
|
use App\Policies\TaskPolicy;
|
2020-10-20 01:01:59 +02:00
|
|
|
use App\Policies\TaskStatusPolicy;
|
2019-10-30 03:41:18 +01:00
|
|
|
use App\Policies\TaxRatePolicy;
|
2019-06-11 05:20:23 +02:00
|
|
|
use App\Policies\UserPolicy;
|
2020-01-20 02:31:58 +01:00
|
|
|
use App\Policies\VendorPolicy;
|
2020-07-06 13:22:36 +02:00
|
|
|
use App\Policies\WebhookPolicy;
|
2019-01-16 10:28:06 +01:00
|
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
|
|
use Illuminate\Support\Facades\Gate;
|
2018-10-04 19:10:43 +02:00
|
|
|
|
|
|
|
class AuthServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The policy mappings for the application.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $policies = [
|
2019-09-27 06:31:13 +02:00
|
|
|
Activity::class => ActivityPolicy::class,
|
2021-03-25 11:55:59 +01:00
|
|
|
Subscription::class => SubscriptionPolicy::class,
|
2019-01-16 10:28:06 +01:00
|
|
|
Client::class => ClientPolicy::class,
|
2019-06-20 08:20:14 +02:00
|
|
|
Company::class => CompanyPolicy::class,
|
2020-04-09 12:48:04 +02:00
|
|
|
CompanyToken::class => CompanyTokenPolicy::class,
|
|
|
|
CompanyGateway::class => CompanyGatewayPolicy::class,
|
|
|
|
Credit::class => CreditPolicy::class,
|
2020-02-28 22:57:47 +01:00
|
|
|
Design::class => DesignPolicy::class,
|
2020-06-23 13:05:41 +02:00
|
|
|
Document::class => DocumentPolicy::class,
|
2020-04-09 12:48:04 +02:00
|
|
|
Expense::class => ExpensePolicy::class,
|
2020-10-13 06:08:56 +02:00
|
|
|
ExpenseCategory::class => ExpenseCategoryPolicy::class,
|
2020-04-09 12:48:04 +02:00
|
|
|
GroupSetting::class => GroupSettingPolicy::class,
|
2019-04-15 02:10:54 +02:00
|
|
|
Invoice::class => InvoicePolicy::class,
|
2019-05-03 09:57:55 +02:00
|
|
|
Payment::class => PaymentPolicy::class,
|
2020-05-26 10:20:50 +02:00
|
|
|
PaymentTerm::class => PaymentTermPolicy::class,
|
2020-04-09 12:48:04 +02:00
|
|
|
Product::class => ProductPolicy::class,
|
2020-10-08 00:25:39 +02:00
|
|
|
Project::class => ProjectPolicy::class,
|
2020-04-09 12:48:04 +02:00
|
|
|
Quote::class => QuotePolicy::class,
|
2019-05-03 00:29:04 +02:00
|
|
|
RecurringInvoice::class => RecurringInvoicePolicy::class,
|
2019-05-05 02:49:01 +02:00
|
|
|
RecurringQuote::class => RecurringQuotePolicy::class,
|
2020-07-06 13:22:36 +02:00
|
|
|
Webhook::class => WebhookPolicy::class,
|
2020-10-12 22:42:02 +02:00
|
|
|
Task::class => TaskPolicy::class,
|
2020-10-20 01:01:59 +02:00
|
|
|
TaskStatus::class => TaskStatusPolicy::class,
|
2019-10-30 03:41:18 +01:00
|
|
|
TaxRate::class => TaxRatePolicy::class,
|
2020-04-09 12:48:04 +02:00
|
|
|
User::class => UserPolicy::class,
|
2020-01-20 02:31:58 +01:00
|
|
|
Vendor::class => VendorPolicy::class,
|
2018-10-04 19:10:43 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any authentication / authorization services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
$this->registerPolicies();
|
2020-03-21 06:37:30 +01:00
|
|
|
|
2019-01-20 06:00:50 +01:00
|
|
|
Gate::define('view-list', function ($user, $entity) {
|
|
|
|
$entity = strtolower(class_basename($entity));
|
2020-09-06 11:38:10 +02:00
|
|
|
|
|
|
|
return $user->hasPermission('view_'.$entity) || $user->isAdmin();
|
2019-01-20 06:00:50 +01:00
|
|
|
});
|
2018-11-03 02:01:40 +01:00
|
|
|
}
|
2018-10-04 19:10:43 +02:00
|
|
|
}
|