function RoleAccessCheck::access

Same name in other branches
  1. 3.x modules/menu_example/src/Access/RoleAccessCheck.php \Drupal\menu_example\Access\RoleAccessCheck::access()
  2. 8.x-1.x menu_example/src/Access/RoleAccessCheck.php \Drupal\menu_example\Access\RoleAccessCheck::access()

Checks access.

Parameters

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

Return value

string A \Drupal\Core\Access\AccessInterface constant value.

File

modules/menu_example/src/Access/RoleAccessCheck.php, line 34

Class

RoleAccessCheck
Determines access to routes based on roles.

Namespace

Drupal\menu_example\Access

Code

public function access(AccountInterface $account) {
    // If the user is authenticated, return TRUE.
    return AccessResult::allowedIf($account->isAuthenticated());
}