Skip to main content
2 of 2
added 856 characters in body
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Drupal 7.15 allows you to bypass the access on the node.

See DANGEROUS_ACCESS_CHECK_OPT_OUT query tag added to EntityFieldQuery for more information.

A "DANGEROUS_ACCESS_CHECK_OPT_OUT" query tag has been added to EntityFieldQuery to allow bypassing access checks. Previously, queries executed through EntityFieldQuery would always be altered by the node access system, potentially causing unexpected behaviour and data loss.

If you need to bypass access checks in an internal query within your module's API, you may add this tag, but you should only do so if it is necessary. If this query tag is added to a query whose results will be displayed to the user, it will bypass all access checks, potentially exposing sensitive information.

function MYMODULE_field_query($field) {
  $query = new EntityFieldQuery();
  return $query
    ->fieldCondition($field)
    ->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT')
    ->execute();
}
user9221
  • 386
  • 3
  • 2