You are here

public function AppsPageAccessCheck::createAppAccess in Apigee Edge 8

Grant access to the user/[uid]/create-apps page.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The parametrized route.

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

Return value

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

File

src/Access/AppsPageAccessCheck.php, line 67

Class

AppsPageAccessCheck
Custom access handler to Apps page.

Namespace

Drupal\apigee_edge\Access

Code

public function createAppAccess(RouteMatchInterface $route_match, AccountInterface $account) {

  /** @var \Drupal\user\UserInterface $user */
  $user = $route_match
    ->getParameter('user');
  if ($user === NULL) {
    return AccessResult::forbidden('User is missing from route.');
  }
  return AccessResultAllowed::allowedIf($account
    ->id() === $user
    ->id() && $account
    ->hasPermission('create developer_app') || $account
    ->hasPermission('administer developer_app'));
}