You are here

function jsonapi_jsonapi_workspace_filter_access in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/jsonapi.module \jsonapi_jsonapi_workspace_filter_access()
  2. 10 core/modules/jsonapi/jsonapi.module \jsonapi_jsonapi_workspace_filter_access()

Implements hook_jsonapi_ENTITY_TYPE_filter_access() for 'workspace'.

File

core/modules/jsonapi/jsonapi.module, line 322
Module implementation file.

Code

function jsonapi_jsonapi_workspace_filter_access(EntityTypeInterface $entity_type, $published, $owner, AccountInterface $account) {

  // @see \Drupal\workspaces\WorkspaceAccessControlHandler::checkAccess()
  return [
    JSONAPI_FILTER_AMONG_ALL => AccessResult::allowedIfHasPermission($account, 'view any workspace'),
    JSONAPI_FILTER_AMONG_OWN => AccessResult::allowedIfHasPermission($account, 'view own workspace'),
  ];
}