Cannot save unpublished versions of published content for users without manage book privileges

Created on 24 October 2017, over 6 years ago
Updated 26 April 2024, about 2 months ago

Problem/Motivation

In 8.4.x and beyond, a new validation has been added for BookOutlines core/modules/book/src/Plugin/Validation/Constraint/BookOutlineConstraintValidator.php
The code in this validation plugin compares previous book values and new values and raises exceptions as needed.
When a user doesnt have permission to administer books and when a node is not part of any book, the entity variable doesnt have any book values and hence when trying to save unpublished versions of published content, the following error is being thrown

You can only change the book outline for the published version of this content.

This can be critical for content moderation when users are not allowed to manage books!

Steps to reproduce

  • As a user without manage books privileges, create an article and publish it (If the user doesnt have publishing rights, publish it with an admin user).
  • Now edit the article as the first user again and try to save it in draft mode.

The node cannot be saved and the error regarding book outline is thrown.

Proposed resolution

Adjust the edit form only when book_type_is_allowed().

Remaining tasks

Commit the patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Fixed bug that caused errors when editing content types that may not be part of a book.

πŸ› Bug report
Status

Needs work

Version

1.0

Component
BookΒ  β†’

Last updated 10 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @pwolanin
Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024