You are here

protected static function DataProviderTaxonomyTerm::checkPropertyAccess in RESTful 7.2

Checks if the data provider user has access to the property.

Parameters

\Drupal\restful\Plugin\resource\Field\ResourceFieldInterface $resource_field: The field to check access on.

string $op: The operation to be performed on the field.

\Drupal\restful\Plugin\resource\DataInterpreter\DataInterpreterInterface $interpreter: The data interpreter.

Return value

bool TRUE if the user has access to the property.

Overrides DataProviderEntity::checkPropertyAccess

File

tests/modules/restful_test/src/Plugin/resource/taxonomy_term/v1/DataProviderTaxonomyTerm.php, line 27
Contains \Drupal\restful_test\Plugin\resource\taxonomy_term\v1\DataProviderTaxonomyTerm.

Class

DataProviderTaxonomyTerm

Namespace

Drupal\restful_test\Plugin\resource\taxonomy_term\v1

Code

protected static function checkPropertyAccess(ResourceFieldInterface $resource_field, $op, DataInterpreterInterface $interpreter) {
  $term = $interpreter
    ->getWrapper()
    ->value();
  if ($resource_field
    ->getProperty() == 'name' && empty($term->tid) && $op == 'edit') {
    return TRUE;
  }
  return parent::checkPropertyAccess($resource_field, $op, $interpreter);
}