You are here

public function ViewPaymentsByOwner::access in Payment 8.2

Checks access to the route.

Parameters

\Drupal\user\UserInterface $user:

Return value

\Drupal\Core\Access\AccessResultInterface

1 string reference to 'ViewPaymentsByOwner::access'
payment.routing.yml in ./payment.routing.yml
payment.routing.yml

File

src/Controller/ViewPaymentsByOwner.php, line 73

Class

ViewPaymentsByOwner
Handles the "view payments by owner" route.

Namespace

Drupal\payment\Controller

Code

public function access(UserInterface $user) {
  return AccessResult::allowedIf($this->currentUser
    ->id() == $user
    ->id() && $this->currentUser
    ->hasPermission('payment.payment.view.own'))
    ->orIf(AccessResult::allowedIf($this->currentUser
    ->hasPermission('payment.payment.view.any')));
}