Commit 6ee87bc5 authored by alexpott's avatar alexpott

Issue #2099259 by Berdir: Missing default access for all taxonomy term fields

parent bbcc4623
<?php
/**
* @file
* Contains \Drupal\Core\Field\ChangedFieldItemList.
*/
namespace Drupal\Core\Field;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Session\AccountInterface;
/**
* Defines a item list class for changed fields.
*/
class ChangedFieldItemList extends FieldItemList {
/**
* {@inheritdoc}
*/
public function defaultAccess($operation = 'view', AccountInterface $account = NULL) {
// It is not possible to edit the changed field.
return AccessResult::allowedIf($operation !== 'edit');
}
}
......@@ -15,6 +15,7 @@
* label = @Translation("Last changed"),
* description = @Translation("An entity field containing a UNIX timestamp of when the entity has been last updated."),
* no_ui = TRUE,
* list_class = "\Drupal\Core\Field\ChangedFieldItemList",
* constraints = {
* "ComplexData" = {"value" = {"EntityChanged" = {}}}
* }
......
......@@ -74,7 +74,6 @@ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_
// No user can change read-only fields.
$read_only_fields = array(
'changed',
'hostname',
'uuid',
'cid',
......
......@@ -145,7 +145,7 @@ protected function checkFieldAccess($operation, FieldDefinitionInterface $field_
}
// No user can change read only fields.
$read_only_fields = array('changed', 'revision_timestamp', 'revision_uid');
$read_only_fields = array('revision_timestamp', 'revision_uid');
if ($operation == 'edit' && in_array($field_definition->getName(), $read_only_fields, TRUE)) {
return AccessResult::forbidden();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment