Skip to content
Snippets Groups Projects

Issue #2918537 by sukanya.ramakrishnan, dww, Manuel Garcia, Arius Vistoon, raman.b, pguillard, mattsqd, manojbisht_drupal, joshua1234511, sonnykt: Cannot save unpublished versions of published content for users without manage book privileges

Open Issue #2918537 by sukanya.ramakrishnan, dww, Manuel Garcia, Arius Vistoon, raman.b, pguillard, mattsqd, manojbisht_drupal, joshua1234511, sonnykt: Cannot save unpublished versions of published content for users without manage book privileges
Files
3
@@ -43,7 +43,12 @@ public static function create(ContainerInterface $container) {
* {@inheritdoc}
*/
public function validate($entity, Constraint $constraint) {
if (isset($entity) && !$entity->isNew() && !$entity->isDefaultRevision()) {
// Validate the book structure when the user has access to manage book
// outlines. When the user can manage book outlines, the book variable will
// be populated even if the node is not part of the book. If the user cannot
// manage book outlines, the book variable will be empty and we can safely
// ignore the constraints as the outline cannot be changed by this user.
if (isset($entity) && !empty($entity->book) && !$entity->isNew() && !$entity->isDefaultRevision()) {
/** @var \Drupal\Core\Entity\ContentEntityInterface $original */
$original = $this->bookManager->loadBookLink($entity->id(), FALSE) ?: [
'bid' => 0,
Loading