function jsonapi_jsonapi_workspace_filter_access in JSON:API 8.2
Same name and namespace in other branches
- 8 jsonapi.module \jsonapi_jsonapi_workspace_filter_access()
Implements hook_jsonapi_ENTITY_TYPE_filter_access() for 'workspace'.
File
- ./
jsonapi.module, line 338 - Module implementation file.
Code
function jsonapi_jsonapi_workspace_filter_access(EntityTypeInterface $entity_type, $published, $owner, AccountInterface $account) {
// @see \Drupal\workspaces\WorkspaceAccessControlHandler::checkAccess()
// \Drupal\jsonapi\Access\TemporaryQueryGuard adds the condition for
// (isDefaultWorkspace()), so this does not have to.
return [
JSONAPI_FILTER_AMONG_ALL => AccessResult::allowedIfHasPermission($account, 'view any workspace'),
JSONAPI_FILTER_AMONG_OWN => AccessResult::allowedIfHasPermission($account, 'view own workspace'),
];
}