protected function PollViewForm::isCancelAllowed in Poll 8
Checks if the current user is allowed to cancel on the given poll.
Parameters
\Drupal\poll\PollInterface $poll:
Return value
bool TRUE if the user can cancel.
1 call to PollViewForm::isCancelAllowed()
- PollViewForm::actions in src/Form/ PollViewForm.php 
File
- src/Form/ PollViewForm.php, line 392 
Class
- PollViewForm
- Displays banned IP addresses.
Namespace
Drupal\poll\FormCode
protected function isCancelAllowed(PollInterface $poll) {
  // Allow access if the user has voted.
  return $poll
    ->hasUserVoted() && $poll
    ->getCancelVoteAllow() && $this
    ->currentUser()
    ->hasPermission('cancel own vote') && (\Drupal::currentUser()
    ->isAuthenticated() || !empty($_SESSION['poll_vote'][$poll
    ->id()])) && $poll
    ->isOpen();
}