function UserSearch::access

Same name in other branches
  1. 9 core/modules/user/src/Plugin/Search/UserSearch.php \Drupal\user\Plugin\Search\UserSearch::access()
  2. 10 core/modules/user/src/Plugin/Search/UserSearch.php \Drupal\user\Plugin\Search\UserSearch::access()
  3. 11.x core/modules/user/src/Plugin/Search/UserSearch.php \Drupal\user\Plugin\Search\UserSearch::access()

Overrides AccessibleInterface::access

File

core/modules/user/src/Plugin/Search/UserSearch.php, line 105

Class

UserSearch
Executes a keyword search for users against the {users} database table.

Namespace

Drupal\user\Plugin\Search

Code

public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
    $result = AccessResult::allowedIf(!empty($account) && $account->hasPermission('access user profiles'))
        ->cachePerPermissions();
    return $return_as_object ? $result : $result->isAllowed();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.