Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UserSearch.php

function UserSearch::access

Overrides AccessibleInterface::access

File

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

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();
}
RSS feed
Powered by Drupal