<?php
namespace App\Security\Voter;
use App\Entity\ExternalLink;
use Symfony\Component\Security\Core\User\UserInterface;
class ExternalLinkVoter extends AbstractDeepVoter
{
public static $listAttribute = 'list_links';
public static $createAttribute = 'create_link';
protected function listAttribute(): string
{
return self::$listAttribute;
}
protected function createAttribute(): string
{
return self::$createAttribute;
}
protected function isSupportedSubject(object $subject): bool
{
return $subject instanceof ExternalLink;
}
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();
}
}