It is somewhat disconcerting to users who have the 'administer book outlines' permission to see the 'outline' tab and 'outline' fieldset on every single node type, regardless of whether that node type has been configured to be allowed in books. I can see a use-case where that might be a desired feature, but i think its probably relatively rare.

The steps to repeat this are:
with a clean install of drupal,
1) turn the book module on
2) configure book module to only use 'book' content type
3) as admin or a user with 'administer book outlines' permission, create or edit a 'page' node (not a book node)

i would expect that 'outline' would not show for 'page' nodes since only 'book' nodes are set to use outlines.

I created the following patch to gracefully address this issue. The simplest solution I could think of was to create an additional checkbox in the content/book/settings form that when checked restricts book outlines to only the designated book-types. By default this is not checked, so that any drupal installs that might rely on "seeing outline information on all node types regardless of config settings" wont be broken by this patch after upgrading.

Its pretty basic, doesn't change anything by default and so hopefully it will be well received (and help someone too!)

CommentFileSizeAuthor
#106 interdiff_104-106.txt797 bytesPrem Suthar
#106 502430-106.patch14.1 KBPrem Suthar
#104 reroll_diff_90-104.txt4.27 KBpooja saraah
#104 502430-104.patch14.1 KBpooja saraah
#101 interdiff_99-101.txt11.66 KBNitin shrivastava
#101 502430-101.patch11.66 KBNitin shrivastava
#99 502430-99.patch11.72 KBDeshna Chauhan
#98 502430-nr-bot.txt3.46 KBneeds-review-queue-bot
#96 502430-96-xhprof-diff.png270.49 KBstar-szr
#90 diff_86-90.txt6.68 KBadityasingh
#90 502430-90.patch14.06 KBadityasingh
#86 502430-86.patch15.55 KBmindbet
#85 interdiff_84-85.txt8.08 KBmindbet
#85 502430-85.patch15.98 KBmindbet
#84 interdiff-502430-80-84.txt1.94 KBtimwood
#84 core_book-outline_permission-502430-84.patch13.49 KBtimwood
#80 core_book-outline_permission-502430-80.patch14.54 KBChris Burge
#79 interdiff-502430-79-68.txt6.62 KBChris Burge
#79 core_book-outline_permission-502430-79.patch14.39 KBChris Burge
#71 Error.jpg93.6 KBdbielke1986
#68 interdiff-502430-68-49.txt33.18 KBChris Burge
#68 interdiff-502430-68-67.txt5.67 KBChris Burge
#68 core_book-outline_permission-502430-68.patch10.23 KBChris Burge
#67 interdiff-502430-65-67.txt648 bytesyogeshmpawar
#67 502430-67.patch10.05 KByogeshmpawar
#65 core_book-outline_permission-502430-65.patch10.05 KBChris Burge
#63 core_book-outline_permission-502430-63.patch10.03 KBChris Burge
#61 core_book-outline_permission-502430-61.patch9.96 KBChris Burge
#59 core_book-outline_permission-502430-59.patch10.18 KBChris Burge
#57 core_book-outline_permission-502430-57.patch8.77 KBChris Burge
#55 core_book-outline_permission-502430-55.patch8.72 KBChris Burge
#53 502430-interdiff-53-49.txt6.62 KBChris Burge
#53 core_book-outline_permission-502430-53.patch8.62 KBChris Burge
#49 limit_book_type-502430-50.patch4.75 KBoriol_e9g
#48 limit_book_type-502430-49.patch4 KBoriol_e9g
#37 drupal-502430-37.patch2.64 KBRoSk0
#37 drupal-502430-36-37-interdiff.txt1.52 KBRoSk0
#36 interdiff.txt612 bytesmikran
#36 force_restricted_content_types_for_books-502430-36.patch2.62 KBmikran
#35 force_restricted_content_types_for_books-502430-45.patch2.62 KBdagomar
#34 force_restricted_content_types_for_books-502430-44.patch2.55 KBdagomar
#12 book_admin_force_restriction.patch727 bytesgirishmuraly
#12 book_module_force_restriction.patch1.09 KBgirishmuraly
#11 book_admin_force_restriction.patch737 bytesgirishmuraly
#11 book_module_force_restriction.patch1.09 KBgirishmuraly
#8 book_force_restriction.patch1.87 KBgirishmuraly
book_force_restriction.patch1.91 KBnetw3rker
#41 1196576-15.patch1.45 KBahmadhalah
#44 remove_book_inclusion_for_all_content_types.patch626 bytesmissvengerberg
#46 limit-book-type-content-502430-43.patch2.35 KBoriol_e9g
#47 limit_book_type-502430-45-only-tests.patch1.11 KBoriol_e9g
#47 limit_book_type-502430-45.patch4.51 KBoriol_e9g
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

garbo’s picture

Where do I need to place this patch in order to work?

I don't know what to do with a patch to make it work.

itaine’s picture

This makes "Allowed book outline types:" actually work! IMHO should be added to core as a fix. Thank you netw3rker!

dyke it’s picture

works perfectly for me. thank you kindly!! :)

TimG1’s picture

Subscribing.

In addition to what netw3rker explained there is another effect to this issue.

Under Content Management > Books > Settings there is this line of text....

"Select content types which users with the add content to books permission will be allowed to add to the book hierarchy. Users with the administer book outlines permission can add all content types."

With the way the book module is today, I don't see a way to enable a role to be able to edit an outline of a given book AND allow them to add only a certain content type to that book.

Since the "administer book outlines" permission will give them the ability to add all content types and they cannot edit outlines without this permission it's an all or nothing for outline editing. Unless I'm missing something obvious?

-Tim

stefan81’s picture

@netw3rker
Thank you!
It worked so far. (Version 6.15)
I hope this patch finds its way into core.

I also thought that should be an obvious behaviour, only to show the outline fieldset on content types which are assigned to books.

girishmuraly’s picture

Status: Patch (to be ported) » Needs review

I think the status to be set to 'needs review' to let the Testing Bot trigger an automated review of the patch, and report the results.

Status: Needs review » Needs work

The last submitted patch, book_force_restriction.patch, failed testing.

girishmuraly’s picture

I guess the patch netw3rker attached was not created from the root directory. Trying again..

girishmuraly’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, book_force_restriction.patch, failed testing.

girishmuraly’s picture

Version: 6.12 » 7.x-dev
Status: Needs work » Needs review
FileSize
1.09 KB
737 bytes

Ok, I must admit I have not got patches to pass testing either. As per the guidelines on creating patches - http://drupal.org/patch/create - we have to create it on the latest dev release. I see this issue is also on 7.x Dev snapshot which I downloaded.

I will try to use two different patch files for book.module and book.admin.inc.

Should this fail, may I request someone to help with the patching please?

Thanks

girishmuraly’s picture

Attaching the patches for Drupal 6 (based on 6.17 release).

girishmuraly’s picture

Version: 7.x-dev » 6.x-dev
netw3rker’s picture

@girishmuraly Thanks! that was my first core patch submission & I just sort of left it after putting it out there. I'm glad its being put to good use somewhere!

Wappie08’s picture

I like this one, doesn't seem to be committed yet, is it going to be??

Greetings Bas

savedario’s picture

Yes, I will be installing this too.

Is there a chance it to be committed into core or is there a code freeze ?

Ciao

lubnax’s picture

subscribe

Status: Needs review » Needs work

The last submitted patch, book_module_force_restriction.patch, failed testing.

stacysimpson’s picture

Ship it! Works great on 6.19.

netw3rker’s picture

Status: Needs work » Reviewed & tested by the community

I'm setting this to "reviewed and tested by the community" hopefully that will get 6.x maintainers to review and comment back on whether and when it will go in.

for the maintainers: This does not change how the existing book module functionality operates, so existing sites and configs will not have to do anything. it provides an option that is disabled by default, but when enabled, allows the book module to function as users would expect it to.

-Chris

tstackhouse’s picture

Subscribing. I just implemented a helper module to effectively do what this patch does, with the exception of simply forcing the administer outlines perm to respect the available types permission.

jelo’s picture

Subscribe

pwolanin’s picture

Version: 6.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Needs work

Patches have code style issues.

bugs have to be fixed in HEAD first.

Gábor Hojtsy’s picture

This patch basically removes a feature, however distracting that feature is, basically this is about removing an unintended feature. Not sure that is a good idea in a stable version (6.x or 7.x alike).

pwolanin’s picture

Discussing with netw3rker over email. A possible way forward would be to link the ability to put any content into books to the 'administer nodes' permission instead.

savedario’s picture

I am not sure I agree with that statement.
Why would you define a feature the possibility to maintain the outline of a content type that is not supposed to have an outline ?
I call this a bug.

Gábor Hojtsy’s picture

Well, I see this as a property of the "administer...." permission. You can set workflow bits for node types on the content type page, but if you have "administer nodes", you can override all that anytime. Same for "administer book outlines", you get more powers. I think that was the thinking when this was implemented. Anyway, generally I agree it looks like a bug, but I can also see how people kind of expect this with an "administer ..." permission.

pwolanin’s picture

@Gabor - I think the present situation makes that permission much less useful than it should be.

I'd favor changing the check about moving all content into books to 'administer nodes' since that is already accepted as having maximal control over content.

netw3rker’s picture

@gabor, the patch as it stands does not actually remove anything, or alter the behavior of existing installations. it gives users the option of making the book module perform as they would expect. However, by default after the patch is applied, nothing changes or functions differently.

In general, the whole issue stems from the fact that there really needs to be 2 permissions here: 1) "administer all books" (which is not the same as administer all nodes) and 2) "add any content to books" which should be for very privileged users who can see/manage any content.

Given that the 2 permission model *would* require a functionality change to core's book module, and *would* effect installations after an upgrade, it makes more sense in my opinion to give users the ability to opt in to the change, and keep things running as expected, than to change the functionality and make everyone who liked it the way it worked originally have to opt out.

That being said, I would rather see this issue get corrected the right way and see a 2 permission model enacted. whether that means we go with "administer all books" and "add any content to books" or its decided that "administer all books" and "administer all nodes" will suffice doesn't particularly matter to me, though i think the former makes the system a bit more configurable than the latter.

-Chris

wjaspers’s picture

Oops, I didn't see this thread before, so I've accidentally submitted a duplicate issue a few days back, where there's a patch as well:
http://drupal.org/node/1196576

scotwith1t’s picture

I don't see why this is still under discussion. It's terribly confusing when you see an Outline tab under nodes that can't/shouldn't be able to be in an outline. #12 works great for me.

soulfroys’s picture

#12 works great for me too...

dagomar’s picture

Status: Needs work » Needs review
FileSize
2.55 KB

I know this is a very old issue, but I still need this in my installation. The old patches don't work with drush make, so I created a new patch, I also did a bit of clean up so the descriptions are in a t() and such.

dagomar’s picture

I had to change my previous patch. The problem was that the node form alter now uses _book_outline_access, which expected a node object (with a nid), however no nid has been set when we create a node. So I altered the access check a little bit so it takes this into account by passing the node type as a string on node creation. Then node_access can handle the rest.

mikran’s picture

+++ b/modules/book/book.module
@@ -201,7 +201,11 @@ function book_menu() {
+  $node = isset($node->nid) ? $node : $node->type;
+  return (user_access('administer book outlines') && ((in_array($type, $types)) || (!$restrict))) && node_access('view', $node);

This does not work when creating a new node. "Notice: Trying to get property of non-object" notices are triggered as $node passed to node_access() is not an object.

Attached patch fixes this.

EDIT: and to reproduce this some spesific conditions are required. User must not have 'bypass node access' permission. User must have 'access content' permission. And finally hook_node_access implementations must not deny or allow access.

RoSk0’s picture

This works as described and fixes confusing issue.

Patch attached is just a re-roll plus minor code standard fix, so all credits to original authors.

David_Rothstein’s picture

Issue tags: +Drupal 7.60 target
David_Rothstein’s picture

Title: 'outline' information shows on node types not enabled for book outlines » Allow the book outline functionality on non-book-enabled node types to be hidden from users with the "Administer book outlines" permission
Version: 7.x-dev » 8.5.x-dev
Category: Bug report » Feature request
Status: Reviewed & tested by the community » Needs work
Issue tags: -Drupal 7.60 target +Needs backport to D7

The same behavior occurs in Drupal 8 so this would need to go in Drupal 8 first.

Also, the current behavior is a documented feature - I can see the rationale for wanting to change it, but am not sure yet-another-setting-in-the-admin-UI is a great way to do it. Splitting out a new permission along the lines of "add any content to books" (as discussed in #30 above) sounds like a better solution - yes, there are some backwards compatibility concerns with that, but relatively minor (there probably isn't too much contrib/custom code out there that interfaces with this part of the Book module, and mostly the concern would be broken links).

Meanwhile, a brief review of the patch:

  1. What happens if non-book content is already in a book? The changes to _book_outline_access() in this patch would make some of the screens for editing it inaccessible (some via broken links in the admin UI, and some via missing links that should be there).
  2. book_help() also documents the current behavior, so maybe it needs to be changed here also?

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ahmadhalah’s picture

the update is working but no need to make user has "administer book outline" permission

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

oriol_e9g’s picture

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

Yeah nice! but still needs tests.

oriol_e9g’s picture

IMO add a new permission is the best approach, as commented in #39.

Added a new permission 'add any content to books', so users with this perm can use the book outline form in all node types, and other users only in allowed book types as expected.

oriol_e9g’s picture

oriol_e9g’s picture

Added a hook_update to grant the new permission to all roles with 'administer book outlines' for backward compatibility.

oriol_e9g’s picture

Status: Needs work » Needs review

All green ready for review :)

oriol_e9g’s picture

Issue tags: -Needs tests
dbielke1986’s picture

Thank you for fixing this issue.
After applying this patch I am getting the following error after saving an exisiting node (content type is not an book enabled one):

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

Is someone having an idea?

Chris Burge’s picture

#49 gets us most of the way there. We also need to control access to the 'entity.node.book_outline_form' route. This route is for path '/node/{id}/outline'.

Attached patch also clarifies some of the comments/language. Tests are updated (but may fail on the first run).

Status: Needs review » Needs work

The last submitted patch, 53: core_book-outline_permission-502430-53.patch, failed testing. View results

Chris Burge’s picture

Status: Needs work » Needs review
FileSize
8.72 KB

Reworked tests.

Status: Needs review » Needs work

The last submitted patch, 55: core_book-outline_permission-502430-55.patch, failed testing. View results

Chris Burge’s picture

Status: Needs work » Needs review
FileSize
8.77 KB

Reworked tests.

Status: Needs review » Needs work

The last submitted patch, 57: core_book-outline_permission-502430-57.patch, failed testing. View results

Chris Burge’s picture

Status: Needs work » Needs review
FileSize
10.18 KB

Status: Needs review » Needs work

The last submitted patch, 59: core_book-outline_permission-502430-59.patch, failed testing. View results

Chris Burge’s picture

Status: Needs work » Needs review
FileSize
9.96 KB

Status: Needs review » Needs work

The last submitted patch, 61: core_book-outline_permission-502430-61.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Chris Burge’s picture

Status: Needs work » Needs review
FileSize
10.03 KB

Status: Needs review » Needs work

The last submitted patch, 63: core_book-outline_permission-502430-63.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Chris Burge’s picture

Status: Needs work » Needs review
FileSize
10.05 KB
yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar
yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
FileSize
10.05 KB
648 bytes

Few coding standard issues resolved & added an interdiff.

Chris Burge’s picture

Attached patch incorporates #67. It also includes additional code standard fixes and comments clean up.

The primary change between #49 and the current patch is that now access to a node’s book settings (both the ‘outline’ tab and the vertical tab on the ‘edit’ page) are controlled by the new BookNodeOutlineAccessCheck access plugin.

Chris Burge’s picture

@JD_1, re #52 - I made several attempts to reproduce the behavior you described. I believe you're getting caught by BookOutlineConstraintValidator::validate(), but I don't know why. Are you able to provide steps to reproduce?

dbielke1986’s picture

I will try it with your last patch tomorrow and give you some feedback. Maybe it is related to the issue/fix for the i18n support for books...

dbielke1986’s picture

FileSize
93.6 KB

Ok: I did some additional tests with the latest patch and here are my results:

For book-enabled content types everything seems to be working fine
If I try to use other content types I still get the error (see attached file)

To get the error I did the following:
1) Apply Patch
2) Run database update
3) Clear cache
4) Uncheck the permission for to add non-book-related content in the permissions
5) Activate the default content moderation worklow for the default content type "basic page"
6) Logon with the user who did not have the permission (point 4)
7) Create a basic page as "draft"
8) Publish this draft/basic page
=> Until this point everything seems to be working
9) Create a new draft
=> Error

dbielke1986’s picture

Status: Needs review » Needs work
dbielke1986’s picture

I checked the access function within the BookNodeOutlineAccessCheck and get the following return for:

a) a book enabled type:
$this->currentUser->hasPermission('add any content to books') = 1
$this->currentUser->hasPermission('add content to books') = 1
!empty($node->book['bid']) = 1
!$node->isNew()) = 1
book_type_is_allowed($node->getType()) = 1

b) a not enabled book type:
$this->currentUser->hasPermission('add any content to books') = 0
$this->currentUser->hasPermission('add content to books') = 1
!empty($node->book['bid']) = 0
!$node->isNew()) = 1
book_type_is_allowed($node->getType()) = 0

BR

Chris Burge’s picture

Status: Needs work » Needs review

@JD_1 - I'm able to reproduce the bug you described without the patch being offered by this issue.

Steps to reproduce:

  1. Install Drupal 8.8 with 'Standard' install profile
  2. Enable the following modules:
    • Book
    • Content Moderation
    • Workflows
  3. Create a 'Test' role with the following permissions:
  4. Book
    • [No permissions granted]
  5. Content Moderation
    • Editorial workflow: Use Create New Draft transition.
    • Editorial workflow: Use Publish transition.
    • View any unpublished content
    • View the latest version
  6. Node
    • Access the Content overview page
    • Administer content
    • Bypass content access control
  7. System
    • Use the administration pages and help
    • View the administration theme
  8. Toolbar
    • Use the toolbar
  9. Workflows
    • Administer workflows
  10. Add the' Basic page' content type to the 'Editorial' content moderation workflow
  11. Create a test user with role 'Test'
  12. Login with test user
  13. Add a 'Basic page' node with workflow state of 'Published'
  14. Create a new revision and save with a workflow state of 'Draft'
  15. Observe validation error: You can only change the book outline for the published version of this content.

You'll need to open a new issue against core for the Book module. I'd mark it as Major since it renders content moderation unusable with no workaround.

dbielke1986’s picture

@Chris-burge

Trank you so much for your quick Response and your test!

Just one question:
If this is a core bug-what is this patch fixing. Or the other way around: what can I test to see that this fix is working.
I thought this is exactly what this patch is trying to do.

Or is the major reason/difference to your system the activated content moderation module?

Chris Burge’s picture

This issue isn't seeking to fix a bug; rather, it's a feature request. Currently, if someone has the 'administer book outlines' permission, then that user can also add non-book content to book outlines. This issue seeks to move that capability to an 'add any content to books' permission. In the event a non-book node is already in a book outline, then the node's book configuration is exposed to users without the permission.

Steps to test:

  1. Create a test user/role with the the 'administer content' permission, along with the following book permissions: 'create new books', 'add content to books', 'administer book outlines'.
  2. Create two 'Basic page' nodes as an administrator.
  3. Add node/1 to a book outline.
  4. Login as the test user
  5. On node/1, observe the test user sees the 'Book outline' vertical tab and the 'Outline' tab on node/1/edit
  6. On node/2, observe the test user does not see the 'Book outline' vertical tab or the 'Outline' tab on node/2/edit
  7. Add the 'add any content to books' permission to the test user
  8. On node/2, observe the test user now sees the 'Book outline' vertical tab and the 'Outline' tab on a 'Basic page' node
ericras’s picture

Status: Needs review » Needs work

1. The titles in book.permissions.yml like Add non-book content to outlines shouldn't have periods after them.
2. Update to book_help() mentioned in #39. I tried to write something but got tongue tied trying to explain exactly what 'Administer book outlines' does now.
3. On /admin/structure/book/settings the description "Users with the 'Administer book outlines' permission can add all content types" needs to be updated. I believe the specified permission just needs to change to 'Add non-book content to outlines'.

Chris Burge’s picture

Assigned: Unassigned » Chris Burge
Chris Burge’s picture

Assigned: Chris Burge » Unassigned
Status: Needs work » Needs review
FileSize
14.39 KB
6.62 KB

@ericras - Good catches. All points have been addressed in the attached patch.

I also modified BookNodeOutlineAccessCheck::access(). Previously, the 'Add non-book content to outlines' permission implicitly granted the 'Add content and child pages to books and manage their hierarchies' permission, too. I have changed this behavior. Now the 'Add non-book content to outlines' permission is only considered if the role already has the 'Add content and child pages to books and manage their hierarchies' permission. Such is now now stated in the permission description for 'Add non-book content to outlines'.

Chris Burge’s picture

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Chris Burge’s picture

Just tested against 8.9.x and 9.1.x. The test failure for 8.9.x can be disregarded. The failure of Drupal\Tests\ComposerIntegrationTest::testComposerLockHash is unrelated.

timwood’s picture

I've rerolled the patch provided by @chris-burge almost a year ago as it was no longer applying to 8.9.x due to other commits to core/modules/book/tests/src/Functional/BookTest.php. Patch and interdiff (I think I did that right) attached.

mindbet’s picture

Patch is updated for 9.1x

Interdiff (not sure if helpful) also attached.

mindbet’s picture

Updated patch to fix 'failed to apply'

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

PCate’s picture

Status: Needs review » Reviewed & tested by the community

Patch applied cleanly and new book permission worked great.

quietone’s picture

Status: Reviewed & tested by the community » Needs work

I took a very brief look at the code and spotted this;

+++ b/core/modules/book/tests/src/Functional/BookTest.php
@@ -363,12 +365,26 @@ class BookTest extends BrowserTestBase {
-    $expected_nids = [$book->id(), $nodes[0]->id(), $nodes[1]->id(), $nodes[2]->id(), $nodes[3]->id(), $nodes[6]->id(), $nodes[4]->id()];
...
-    $expected_nids = [$book->id(), $nodes[0]->id(), $nodes[1]->id(), $nodes[2]->id(), $nodes[4]->id()];

Both of these changes appear to be out of scope.

adityasingh’s picture

Status: Needs work » Needs review
FileSize
14.06 KB
6.68 KB

Reroll the patch for 9.2.x and fixed as suggested in #89.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Ahmad Abbad’s picture

Patch #90 worked for me on 9.2.5

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

joachim’s picture

The issue summary doesn't correspond to the fix in the most recent patch.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

star-szr’s picture

Issue tags: +Performance
FileSize
270.49 KB

I think the "Performance" tag may be justifiable here, and if so, makes me think that this could be bumped from a feature request to a task.

The following xhprof diff is from a real-world site, showing the difference on a node edit form which is not enabled as a book content type. Before is without the patch, After is with the patch from #90. I'm testing as a user that does not have the newly added permission in this scenario.

This could probably use more profiling with a more "stock" setup for sure.

xhprof diff report

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
3.46 KB

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Deshna Chauhan’s picture

Added patch against #90 in version 10.1.

BramDriesen’s picture

Hiding patch #99 as it's incomplete. You omitted the /core/modules/book/src/Access/BookNodeOutlineAccessCheck.php class

@Deshna Chauhan Please stop uploading incomplete and broken re-roll patches without an interdiff.

Nitin shrivastava’s picture

@BramDriesen Try to addressed your point add all file in reroll for d10.

BramDriesen’s picture

@Nitin shrivastava Thanks, but your patch is still missing the /core/modules/book/src/Access/BookNodeOutlineAccessCheck.php class. And from a quick glance you're also missing a newline in the first code block.

I suggest to ignore what was done in #99 and start fresh from the patch in #90.

Hiding your patch and interdiff as well for that reason.

For the next person coming in. Start from #90 and provide a patch+interdiff based of that patch.

quietone’s picture

@Deshna Chauhan and @Nitin shrivastava I am removing credit for the unhelpful patches per How is credit granted for Drupal core issues.

pooja saraah’s picture

Addressed the Comment #102
Attached patch against Drupal 10.1.x
Attached reroll patch

BramDriesen’s picture

@pooja saraah That looks a lot better! Thanks :)

Needs work still justified for #94

Prem Suthar’s picture

Re-Roll The Patch #104 Due To Custom CMD Failed.

pooja saraah’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Still needs issue summary update from #94

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

This extension is being deprecated, see #3376070: [Meta] Tasks to deprecate Book module. It will be removed from core and moved to a contrib project, #3376101: [11.x] [Meta] Tasks to remove Book.

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

This issue may be re-opened if it can be considered critical, If unsure, re-open the issue and ask in a comment.