You are here

public function GroupRevisionCheck::access in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/Access/GroupRevisionCheck.php \Drupal\group\Entity\Access\GroupRevisionCheck::access()

Checks routing access for group revision operations.

Parameters

\Symfony\Component\Routing\Route $route: The route to check against.

\Drupal\Core\Session\AccountInterface $account: The currently logged in account.

\Drupal\Core\Routing\RouteMatchInterface|null $route_match: (optional) The route match.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

File

src/Entity/Access/GroupRevisionCheck.php, line 66

Class

GroupRevisionCheck
Checks access to a group revision.

Namespace

Drupal\group\Entity\Access

Code

public function access(Route $route, AccountInterface $account, RouteMatchInterface $route_match = NULL) {
  if (empty($route_match)) {
    $route_match = $this->routeMatch;
  }
  $operation = $route
    ->getRequirement('_group_revision');
  if ($operation === 'list') {
    $group = $route_match
      ->getParameter('group');
    return $this
      ->checkAccess($group, $account);
  }
  else {
    $group_revision = $route_match
      ->getParameter('group_revision');
    return $this
      ->checkAccess($group_revision, $account, $operation);
  }
}