function jsonapi_jsonapi_shortcut_filter_access

Implements hook_jsonapi_ENTITY_TYPE_filter_access() for 'shortcut'.

File

core/modules/jsonapi/jsonapi.module, line 274

Code

function jsonapi_jsonapi_shortcut_filter_access(EntityTypeInterface $entity_type, AccountInterface $account) {
  // @see \Drupal\shortcut\ShortcutAccessControlHandler::checkAccess()
  // \Drupal\jsonapi\Access\TemporaryQueryGuard adds the condition for
  // (shortcut_set = shortcut_current_displayed_set()), so this does not have
  // to.
  return [
    JSONAPI_FILTER_AMONG_ALL => AccessResult::allowedIfHasPermission($account, 'administer shortcuts')->orIf(AccessResult::allowedIfHasPermissions($account, [
      'access shortcuts',
      'customize shortcut links',
    ])),
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.