2020-01-20 02:31:58 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-01-20 02:31:58 +01:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Policies;
|
|
|
|
|
|
|
|
use App\Models\User;
|
2020-09-06 11:38:10 +02:00
|
|
|
use App\Models\Vendor;
|
2020-01-20 02:31:58 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Class VendorPolicy.
|
2020-01-20 02:31:58 +01:00
|
|
|
*/
|
|
|
|
class VendorPolicy extends EntityPolicy
|
|
|
|
{
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Checks if the user has create permissions.
|
2020-01-20 02:31:58 +01:00
|
|
|
*
|
|
|
|
* @param User $user
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function create(User $user) : bool
|
|
|
|
{
|
|
|
|
return $user->isAdmin() || $user->hasPermission('create_vendor') || $user->hasPermission('create_all');
|
|
|
|
}
|
|
|
|
}
|