Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
6ee87bc5
Commit
6ee87bc5
authored
Nov 28, 2014
by
alexpott
Browse files
Issue
#2099259
by Berdir: Missing default access for all taxonomy term fields
parent
bbcc4623
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Field/ChangedFieldItemList.php
0 → 100644
View file @
6ee87bc5
<?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'
);
}
}
core/lib/Drupal/Core/Field/Plugin/Field/FieldType/ChangedItem.php
View file @
6ee87bc5
...
...
@@ -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" = {}}}
* }
...
...
core/modules/comment/src/CommentAccessControlHandler.php
View file @
6ee87bc5
...
...
@@ -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'
,
...
...
core/modules/node/src/NodeAccessControlHandler.php
View file @
6ee87bc5
...
...
@@ -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
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment