<?php
namespace App\Security\Voter;
use App\Entity\Retailer;
use Symfony\Component\Security\Core\User\UserInterface;
class RetailerVoter extends AbstractDeepVoter
{
public static $listAttribute = 'list_retailers';
public static $createAttribute = 'create_retailer';
protected function listAttribute(): string
{
return self::$listAttribute;
}
protected function createAttribute(): string
{
return self::$createAttribute;
}
protected function isSupportedSubject(object $subject): bool
{
return $subject instanceof Retailer;
}
protected function canList(UserInterface $user): bool
{
return $user->isAnAdmin();
}
protected function canCreate(UserInterface $user): bool
{
return $user->isMainAdmin();
}
protected function canRead(UserInterface $user): bool
{
return $user->isAnAdmin();
}
protected function canUpdate(UserInterface $user): bool
{
return $user->isMainAdmin();
}
protected function canDelete(UserInterface $user): bool
{
return $user->isMainAdmin();
}
}