You are here

public function ViewOwnTrackerAccessCheck::access in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/tracker/src/Access/ViewOwnTrackerAccessCheck.php \Drupal\tracker\Access\ViewOwnTrackerAccessCheck::access()

Checks access.

Parameters

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

\Drupal\user\UserInterface $user: The user whose tracker page is being accessed.

Return value

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

File

core/modules/tracker/src/Access/ViewOwnTrackerAccessCheck.php, line 31
Contains \Drupal\tracker\Access\ViewOwnTrackerAccessCheck.

Class

ViewOwnTrackerAccessCheck
Access check for user tracker routes.

Namespace

Drupal\tracker\Access

Code

public function access(AccountInterface $account, UserInterface $user) {
  return AccessResult::allowedIf($user && $account
    ->isAuthenticated() && $user
    ->id() == $account
    ->id())
    ->cachePerUser();
}