function JsonapiHooks::jsonapiEntityFilterAccess
Same name and namespace in other branches
- 11.x core/modules/jsonapi/src/Hook/JsonapiHooks.php \Drupal\jsonapi\Hook\JsonapiHooks::jsonapiEntityFilterAccess()
Implements hook_jsonapi_entity_filter_access().
Attributes
#[Hook('jsonapi_entity_filter_access')]
File
-
core/
modules/ jsonapi/ src/ Hook/ JsonapiHooks.php, line 102
Class
- JsonapiHooks
- Hook implementations for jsonapi.
Namespace
Drupal\jsonapi\HookCode
public function jsonapiEntityFilterAccess(EntityTypeInterface $entity_type, AccountInterface $account) : array {
// All core entity types and most or all contrib entity types allow users
// with the entity type's administrative permission to view all of the
// entities, so enable similarly permissive filtering to those users as
// well. A contrib module may override this decision by returning
// AccessResult::forbidden() from its implementation of this hook.
if ($admin_permission = $entity_type->getAdminPermission()) {
return [
JsonApiFilter::AMONG_ALL => AccessResult::allowedIfHasPermission($account, $admin_permission),
];
}
return [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.