function jsonapi_jsonapi_user_filter_access in JSON:API 8.2
Same name and namespace in other branches
- 8 jsonapi.module \jsonapi_jsonapi_user_filter_access()
Implements hook_jsonapi_ENTITY_TYPE_filter_access() for 'user'.
File
- ./
jsonapi.module, line 325 - Module implementation file.
Code
function jsonapi_jsonapi_user_filter_access(EntityTypeInterface $entity_type, AccountInterface $account) {
// @see \Drupal\user\UserAccessControlHandler::checkAccess()
// \Drupal\jsonapi\Access\TemporaryQueryGuard adds the condition for
// (!isAnonymous()), so this does not have to.
return [
JSONAPI_FILTER_AMONG_OWN => AccessResult::allowed(),
JSONAPI_FILTER_AMONG_ENABLED => AccessResult::allowedIfHasPermission($account, 'access user profiles'),
];
}