Problem/Motivation

The EntityAccessControlHandler::checkAccess has an $entity parameter that should respect the EntityInterface.

Yet in the checkAccess() method there's a call on the $entity object to a method that's not on the EntityInterface:

$entity->isDefaultRevision() && $entity->isLatestRevision()

isDefaultRevision() && isLatestRevision() lives in ContentEntityBase but not in EntityInterface.

This may result in an error :

 Call to an undefined method Drupal\Core\Entity\EntityInterface::isDefaultRevision().
 Call to an undefined method Drupal\Core\Entity\EntityInterface::isLatestRevision().

Steps to reproduce

Create a custom revisionable entity and add revision ui as defined in Revision UI available to revisionable entities and observe the errors above in AccessControlHandler Class.

Proposed resolution

We should check if the entity is an instance of RevisionableInterface first in AccessControlHandler Class.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

Bhanu951 created an issue. See original summary.

bhanu951’s picture

Issue summary: View changes

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.