src/Security/Voter/ChatNotification/ShowVoter.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Security\Voter\ChatNotification;
  3. use App\Entity\Account\User;
  4. use App\Entity\Channel\Channel;
  5. use App\Entity\ChannelUserData\ChannelUserData;
  6. use App\Security\Voter\AbstractVoter;
  7. class ShowVoter extends AbstractVoter
  8. {
  9.     protected function supportedAttribute(): string
  10.     {
  11.         return 'NIM_NOTIFICATION';
  12.     }
  13.     protected function grant(User $user$subjectChannelUserData $channelUserData): int
  14.     {
  15.         return true;
  16.     }
  17.     protected function getChannelUserData(User $user$subject): ?ChannelUserData
  18.     {
  19.         return $user->getChannelUserDataByChannel($subject);
  20.     }
  21.     protected function supportSubject($subject): bool
  22.     {
  23.         return $subject instanceof Channel;
  24.     }
  25. }