This seems too obvious, but the book module's outline is not restricted by allowed content types on the node/add form.
To reproduce:
1) Standard profile installation 8.2.7 and enable the Book module.
2) Go to /admin/structure/book/settings and select only the "Article" content type for "Content types allowed in book outlines".
3) Go to /node/add/page to create a new "Basic Page". Notice, the "Book Outline" fieldset is visible although you'd expect the settings in #2 to restrict the Basic Page content type.

Comments

ericpugh created an issue. See original summary.

empesan’s picture

Assigned: Unassigned » empesan
Issue tags: +DevDaysSeville
empesan’s picture

Status: Active » Needs review
FileSize
5.98 KB

Reproduced issue and patch added.

ericpugh’s picture

FileSize
5.32 KB

I've tested this patch on Drupal 8.2.7 and it gets rid of the issue, however I'm seeing some (strange) errors in the dblog when creating content.
To reproduce:
1. Follow the steps in the original description, so that the "Article" content type is the only allowed content type in a book outline.
2. Create an article /node/add/article filling out only the Title and Body fields and adding to a book outline.
3. Errors in the dblog: /admin/reports/dblog

I'm not sure how the (attached) errors are related to this patch, but I did tested this on an identical clean install without the patch, and wasn't able to create the error.

Haza’s picture

Version: 8.2.7 » 8.4.x-dev
FileSize
5.83 KB

patch rerolled against 8.4.x

I didn't checked about the errors for now.

Status: Needs review » Needs work

The last submitted patch, 5: book_outline_not-2862291-5.patch, failed testing.

Haza’s picture

Status: Needs work » Needs review

Relaunched tests against 8.4.x

mathysp’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

I've tested the patch. Seems to work correctly on drupal v8.3. I do not see any errors in my dblog.

This patch will need tests though.

rakesh.gectcr’s picture

Assigned: empesan » rakesh.gectcr

Working on the test

rakesh.gectcr’s picture

Status: Needs work » Needs review
FileSize
3.54 KB
9.51 KB
rakesh.gectcr’s picture

Assigned: rakesh.gectcr » Unassigned
mr.baileys’s picture

This issue has been raised in the past (see for example #848470: _book_outline_access not restricting allowed types), and the fact that users with "Administer book outlines" permission can add all types to a book is noted on the book settings page:

So this is either a "Closed (works as designed)", or a Feature/Task instead of a bug.

mathysp’s picture

Category: Bug report » Feature request

I think it's worthy enough to consider this as a separate feature. Either way, this case is relevant; As of right now there is no good way to give a user role permission to only edit the book outlines, but still be limited to only the selected content-types.

I think there are two possible improvements that can be made:

1) Split up the permission so it is two-fold;
* Administer book outline:
* Can use all content-types in book outline

2) Add/enable an extra option so we can define wether or not admins can add all CT's or not.
* This can be a radio added to the structure/book/settings page

Meanwhile, we will use the patch from this issue.