You are here

function restws_property_access_filter in RESTful Web Services 7

Same name and namespace in other branches
  1. 7.2 restws.formats.inc \restws_property_access_filter()

Filters out properties where view access is not allowed for the current user.

Parameters

EntityMetadataWrapper $wrapper: EntityMetadataWrapper that should be checked.

Return value

An array of properties where access is allowed, keyed by their property name.

3 calls to restws_property_access_filter()
RestWSBaseFormat::getData in ./restws.formats.inc
Gets a simple PHP array using URI references for some wrapped data.
RestWSFormatRDF::addToXML in ./restws.formats.inc
Adds the data of the given wrapper to the given XML element.
RestWSFormatXML::addToXML in ./restws.formats.inc
Adds the data of the given wrapper to the given XML element.

File

./restws.formats.inc, line 183
RESTful web services module formats.

Code

function restws_property_access_filter($wrapper) {
  $filtered = array();
  foreach ($wrapper as $name => $property) {
    if ($property
      ->access('view')) {
      $filtered[$name] = $property;
    }
  }
  return $filtered;
}