.. include:: ../Includes.txt .. _pollPermission: PollPermission ============== t3oodle has got a central class controlling poll permission logic. **Existing permissions are:** - ``isViewingInGeneralAllowed($poll)`` - ``isViewingAllowed($poll)`` - ``isShowAllowed($poll)`` - ``isNewAllowed()`` - ``isNewSimplePollAllowed()`` - ``isNewSchedulePollAllowed()`` - ``isEditAllowed($poll)`` - ``isDeleteAllowed($poll)`` - ``isPublishAllowed($poll)`` - ``isFinishAllowed($poll)`` - ``isFinishSuggestionModeAllowed($poll)`` - ``isSuggestNewOptionsAllowed($poll)`` - ``isVotingAllowed($poll)`` - ``isSeeParticipantsDuringVotingAllowed($poll)`` - ``isSeeVotesDuringVotingAllowed($poll)`` - ``isAdministrationAllowed($poll)`` - ``isResetVotesAllowed($poll)`` - ``isDeleteOwnVoteAllowed($vote)`` **!!!** They are used in controller actions, as well as in Fluid templates. Permission ViewHelper --------------------- :: // show new button The action is passed without trailing **is** and **Allowed**. When a permission requires poll or vote argument, you can call it like this: :: // show delete button, for this poll Modifying permissions --------------------- Every permission can get changed programmatically, by using :ref:`signalSlots`. First register your slot in ``ext_localconf.php``: :: /** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */ $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); $signalSlotDispatcher->connect( \FGTCLB\T3oodle\Domain\Permission\PollPermission::class, 'isNewSimplePollAllowed', \Vendor\MyExt\Slots\PollPermissionSlots::class, 'isNewSimplePollAllowed' ); The ``PollPermissionSlots`` class looks like this: :: final class PollPermissionSlots { public function isNewSimplePollAllowed(bool $currentStatus, array $arguments, PollPermission $caller): array { $newStatus = false; // TODO: implement me return [ 'currentStatus' => $newStatus, 'arguments' => $arguments, 'caller' => $caller, ]; } }