You are here

public function ResourceField::access in RESTful 7.2

Check access on property by the defined access callbacks.

Parameters

string $op: The operation that access should be checked for. Can be "view" or "edit". Defaults to "edit".

DataInterpreterInterface $interpreter: The data source representing the entity.

Return value

bool TRUE if the current user has access to set the property, FALSE otherwise. The default implementation assumes that if no callback has explicitly denied access, we grant the user permission.

Overrides ResourceFieldInterface::access

File

src/Plugin/resource/Field/ResourceField.php, line 84
Contains \Drupal\restful\Plugin\resource\ResourceField.

Class

ResourceField

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function access($op, DataInterpreterInterface $interpreter) {
  foreach ($this
    ->getAccessCallbacks() as $callback) {
    $result = ResourceManager::executeCallback($callback, array(
      $op,
      $this,
      $interpreter,
    ));
    if ($result == ResourceFieldBase::ACCESS_DENY) {
      return FALSE;
    }
  }
  return TRUE;
}