mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +01:00
0c1fc0d904
* Wire up Create Entity Button to create route * Refactor permissions, we must also ensure the user company id and entity id matches at the Gate:: * Add translations for Status filters * Bug fix for initial list view not displaying * Apply actions to menu for list items * Wire up list view actions, individual * Place permission filters on datatable lists
52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Client;
|
|
use App\Policies\ClientPolicy;
|
|
use Auth;
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
class AuthServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* The policy mappings for the application.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $policies = [
|
|
Client::class => ClientPolicy::class,
|
|
];
|
|
|
|
/**
|
|
* Register any authentication / authorization services.
|
|
*
|
|
* @return void
|
|
*/
|
|
|
|
public function boot()
|
|
{
|
|
$this->registerPolicies();
|
|
|
|
Auth::provider('users', function ($app, array $config) {
|
|
return new MultiDatabaseUserProvider($this->app['hash'], $config['model']);
|
|
});
|
|
|
|
Auth::provider('contacts', function ($app, array $config) {
|
|
return new MultiDatabaseUserProvider($this->app['hash'], $config['model']);
|
|
|
|
});
|
|
|
|
Gate::define('view-list', function ($user, $entity) {
|
|
|
|
$entity = strtolower(class_basename($entity));
|
|
|
|
return $user->hasPermission('view_' . $entity) || $user->isAdmin();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|