You are here

protected function RestWSEntityResourceController::nodeAccess in RESTful Web Services 7.2

Helper function to respect node permissions while querying.

Parameters

EntityFieldQuery $query: The query object.

2 calls to RestWSEntityResourceController::nodeAccess()
RestWSEntityResourceController::count in ./restws.entity.inc
Implements RestWSQueryResourceControllerInterface::count().
RestWSEntityResourceController::query in ./restws.entity.inc
Implements RestWSQueryResourceControllerInterface::query().

File

./restws.entity.inc, line 313
RESTful web services module integration for entities.

Class

RestWSEntityResourceController
Controller for entity-bases resources.

Code

protected function nodeAccess(EntityFieldQuery $query) {

  // Respect node access and filter out unpublished nodes if user lacks
  // the right permission.
  if ($this
    ->resource() == 'node') {
    $query
      ->addTag('node_access');
    if (!user_access('bypass node access')) {
      $this
        ->propertyQueryOperation($query, 'Condition', 'status', 1);
    }
  }
}