You are here

public function VotingApiController::voteAccess in Vote Up/Down 8

Checks if the currentUser is allowed to vote.

Return value

\Drupal\Core\Access\AccessResult|\Drupal\Core\Access\AccessResultAllowed The access result.

1 string reference to 'VotingApiController::voteAccess'
vud.routing.yml in ./vud.routing.yml
vud.routing.yml

File

src/Controller/VotingApiController.php, line 141

Class

VotingApiController
Controller for voting.

Namespace

Drupal\vud\Controller

Code

public function voteAccess() {

  // Check if user has permission to vote.
  if (!vud_can_vote($this
    ->currentUser())) {
    return AccessResult::forbidden();
  }
  else {
    return AccessResultAllowed::allowed();
  }
}