You are here

protected function TeamAppRouteProvider::getCollectionRoute in Apigee Edge 8

Gets the collection route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

Overrides DefaultHtmlRouteProvider::getCollectionRoute

File

modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php, line 82

Class

TeamAppRouteProvider
Default entity routes for team apps.

Namespace

Drupal\apigee_edge_teams\Entity

Code

protected function getCollectionRoute(EntityTypeInterface $entity_type) {
  $route = parent::getCollectionRoute($entity_type);
  if ($route) {
    $requirements = $route
      ->getRequirements();

    // Users with "Manage Team Apps" permission should also have access.
    $permission = TeamAppPermissionProvider::MANAGE_TEAM_APPS_PERMISSION;
    if (isset($requirements['_permission'])) {
      $requirements['_permission'] .= "+{$permission}";
    }
    else {
      $requirements['_permission'] = $permission;
    }
    $route
      ->setRequirements($requirements);
  }
  return $route;
}