src/AdminSections/AffiliatePortNetworkAccounts/AffiliatePortNetworkAccountsVoter.php line 13

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace PPAdmin\AdminSections\AffiliatePortNetworkAccounts;
  3. use PlnaPenezenka\PPSDKBundle\Doctrine\Entity\Administrator;
  4. use PlnaPenezenka\PPSDKBundle\Doctrine\Entity\Common\DefaultEntity;
  5. use PlnaPenezenka\PPSDKBundle\Service\AffiliatePortClient\Models\V1\Affiliate\AffiliatePortNetworkAccount;
  6. use PPAdmin\AdminSections\AdminSectionsList;
  7. use PPAdmin\Security\AbstractAdminGridSectionVoter;
  8. class AffiliatePortNetworkAccountsVoter extends AbstractAdminGridSectionVoter
  9. {
  10.     public static function getSectionIdentifier(): string
  11.     {
  12.         return AdminSectionsList::AFFILIATE_PORT_NETWORK_ACCOUNTS;
  13.     }
  14.     protected static function getSupportedSectionPermissions(): array
  15.     {
  16.         $permissions parent::getSupportedSectionPermissions();
  17.         $idx array_search(self::SECTION_PERMISSION_VIEW_AUDIT$permissions);
  18.         unset($permissions[$idx]);
  19.         return array_values($permissions);
  20.     }
  21.     function canViewSectionRecord(Administrator $adminAffiliatePortNetworkAccount|DefaultEntity $record): bool
  22.     {
  23.         $current_web $this->webs_resolver->getCurrentManagedWeb();
  24.         return
  25.             $this->canAccessSection($admin$current_web) &&
  26.             $admin->hasPermission(static::getViewDetailPermission(), $current_web);
  27.     }
  28.     function canEditRecord(Administrator $adminAffiliatePortNetworkAccount|DefaultEntity $record): bool
  29.     {
  30.         $current_web $this->webs_resolver->getCurrentManagedWeb();
  31.         return
  32.             $this->canAccessSection($admin$current_web) &&
  33.             $admin->hasPermission(static::getEditPermission(), $current_web);
  34.     }
  35.     function canDeleteRecord(Administrator $adminAffiliatePortNetworkAccount|DefaultEntity $record): bool
  36.     {
  37.         $current_web $this->webs_resolver->getCurrentManagedWeb();
  38.         return
  39.             $this->canAccessSection($admin$current_web) &&
  40.             $admin->hasPermission(static::getDeletePermission(), $current_web);
  41.     }
  42.     function canViewRecordAudit(Administrator $adminAffiliatePortNetworkAccount|DefaultEntity $record): bool
  43.     {
  44.         return false;
  45.     }
  46. }