You are here

public function UserSettingsAccess::access in Notify 1.0.x

Same name and namespace in other branches
  1. 8 src/Access/UserSettingsAccess.php \Drupal\notify\Access\UserSettingsAccess::access()
  2. 2.0.x src/Access/UserSettingsAccess.php \Drupal\notify\Access\UserSettingsAccess::access()

Checks access for the UserSettings form.

Parameters

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

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

Return value

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

1 string reference to 'UserSettingsAccess::access'
notify.routing.yml in ./notify.routing.yml
notify.routing.yml

File

src/Access/UserSettingsAccess.php, line 27

Class

UserSettingsAccess
Class UserSettingsAccess.

Namespace

Drupal\notify\Access

Code

public function access(RouteMatchInterface $route_match, AccountInterface $account) {
  $current_user = $route_match
    ->getParameter('user');
  if ($current_user === $account
    ->id()) {
    return AccessResult::allowedIf($account
      ->hasPermission('access notify'));
  }
  return AccessResult::allowedIf($account
    ->hasPermission('administer notify'));
}