1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00
invoiceninja/app/Providers/AuthServiceProvider.php

60 lines
2.7 KiB
PHP
Raw Normal View History

2016-04-23 17:52:36 +02:00
<?php
namespace App\Providers;
2017-11-14 09:58:08 +01:00
use Gate;
2016-04-23 17:52:36 +02:00
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
2016-04-26 03:53:39 +02:00
\App\Models\Client::class => \App\Policies\ClientPolicy::class,
2017-03-27 10:33:37 +02:00
\App\Models\Contact::class => \App\Policies\ContactPolicy::class,
2016-04-26 03:53:39 +02:00
\App\Models\Credit::class => \App\Policies\CreditPolicy::class,
\App\Models\Document::class => \App\Policies\DocumentPolicy::class,
\App\Models\Expense::class => \App\Policies\ExpensePolicy::class,
2017-06-26 06:16:29 +02:00
\App\Models\RecurringExpense::class => \App\Policies\RecurringExpensePolicy::class,
2016-07-06 20:35:16 +02:00
\App\Models\ExpenseCategory::class => \App\Policies\ExpenseCategoryPolicy::class,
2016-04-26 03:53:39 +02:00
\App\Models\Invoice::class => \App\Policies\InvoicePolicy::class,
2018-07-24 14:35:49 +02:00
\App\Models\Quote::class => \App\Policies\QuotePolicy::class,
2016-04-26 03:53:39 +02:00
\App\Models\Payment::class => \App\Policies\PaymentPolicy::class,
\App\Models\Task::class => \App\Policies\TaskPolicy::class,
\App\Models\Vendor::class => \App\Policies\VendorPolicy::class,
2016-05-02 15:12:37 +02:00
\App\Models\Product::class => \App\Policies\ProductPolicy::class,
\App\Models\TaxRate::class => \App\Policies\TaxRatePolicy::class,
2016-05-06 21:05:28 +02:00
\App\Models\AccountGateway::class => \App\Policies\AccountGatewayPolicy::class,
2016-08-02 16:38:51 +02:00
\App\Models\AccountToken::class => \App\Policies\TokenPolicy::class,
2017-11-29 11:44:28 +01:00
\App\Models\Subscription::class => \App\Policies\SubscriptionPolicy::class,
2016-05-06 21:05:28 +02:00
\App\Models\BankAccount::class => \App\Policies\BankAccountPolicy::class,
\App\Models\PaymentTerm::class => \App\Policies\PaymentTermPolicy::class,
2016-11-29 18:47:26 +01:00
\App\Models\Project::class => \App\Policies\ProjectPolicy::class,
\App\Models\AccountGatewayToken::class => \App\Policies\CustomerPolicy::class,
2018-01-31 15:33:33 +01:00
\App\Models\Proposal::class => \App\Policies\ProposalPolicy::class,
\App\Models\ProposalSnippet::class => \App\Policies\ProposalSnippetPolicy::class,
\App\Models\ProposalTemplate::class => \App\Policies\ProposalTemplatePolicy::class,
\App\Models\ProposalCategory::class => \App\Policies\ProposalCategoryPolicy::class,
2016-04-23 17:52:36 +02:00
];
2016-05-06 21:05:28 +02:00
2016-04-23 17:52:36 +02:00
/**
* Register any application authentication / authorization services.
*
2017-01-30 20:40:43 +01:00
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
*
2016-04-23 17:52:36 +02:00
* @return void
*/
2017-11-14 09:58:08 +01:00
public function boot()
2016-04-23 17:52:36 +02:00
{
2017-01-30 20:40:43 +01:00
foreach (get_class_methods(new \App\Policies\GenericEntityPolicy()) as $method) {
2017-11-14 09:58:08 +01:00
Gate::define($method, "App\Policies\GenericEntityPolicy@{$method}");
2016-04-26 03:53:39 +02:00
}
2016-07-06 20:35:16 +02:00
2017-11-14 09:58:08 +01:00
$this->registerPolicies();
2016-04-23 17:52:36 +02:00
}
2016-07-06 20:35:16 +02:00
}