<?php declare(strict_types=1);
namespace PPAdmin\AdminSections\AffiliatePortNetworks;
use PlnaPenezenka\PPSDKBundle\Doctrine\Entity\Administrator;
use PlnaPenezenka\PPSDKBundle\Doctrine\Entity\Common\DefaultEntity;
use PlnaPenezenka\PPSDKBundle\Doctrine\Entity\Web;
use PlnaPenezenka\PPSDKBundle\Service\AffiliatePortClient\Models\V1\Affiliate\AffiliatePortNetwork;
use PPAdmin\AdminSections\AdminSectionsList;
use PPAdmin\Security\AbstractAdminGridSectionVoter;
class AffiliatePortNetworksVoter extends AbstractAdminGridSectionVoter
{
public static function getSectionIdentifier(): string
{
return AdminSectionsList::AFFILIATE_PORT_NETWORKS;
}
protected static function getSupportedSectionPermissions(): array
{
return [
self::SECTION_PERMISSION_ACCESS,
self::SECTION_PERMISSION_LIST,
self::SECTION_PERMISSION_VIEW_DETAIL
];
}
function canViewSectionRecord(Administrator $admin, AffiliatePortNetwork|DefaultEntity $record): bool
{
$current_web = $this->webs_resolver->getCurrentManagedWeb();
return
$this->canAccessSection($admin, $current_web) &&
$admin->hasPermission(static::getViewDetailPermission(), $current_web);
}
function canCreateSectionRecords(Administrator $admin, Web $web): bool
{
return false;
}
function canEditRecord(Administrator $admin, AffiliatePortNetwork|DefaultEntity $record): bool
{
return false;
}
function canDeleteRecord(Administrator $admin, AffiliatePortNetwork|DefaultEntity $record): bool
{
return false;
}
function canViewRecordAudit(Administrator $admin, AffiliatePortNetwork|DefaultEntity $record): bool
{
return false;
}
}