I noticed a but in the newest 7.x version of this module. Here's how you can reproduce the issue:

1) Create a book and set permissions (e.g. add several roles, and maybe add an individual user to have partial permissions).
2) Click "Save configuration". It saves properly as expected. If you log in as one of the users in question, book permissions are configured accurately.
3) Go to the book node's edit screen, and change something (e.g. the node's body text). Save the node.
4) Go back to the Book Access tab. All checkboxes are now reset to nothing (no roles have permission any longer).

Has anyone else seen this?

Thanks,
Nathan

Comments

visuaLatte’s picture

Nobody else had/seen this issue?

Mark Nielsen’s picture

Yes, I am also experiencing this. Agree it's a critical bug.

dbgray’s picture

I have seen this issue as well. Its important to my project that it get fixed, and I am working on a solution. If anyone else has already started on a solution, to this issue, please let me know.

Anonymous’s picture

I am also experiencing the exact same issue... which was driving me and a co-worker crazy until we notice it was the module.

joelschou’s picture

Same problem here. Book access appears to hold great promise, but isn't particularly usable on D7. It also hasn't been touched in nearly 10 months. Bummer.

ppc.coder’s picture

I found this bit of code starting at line 850 of book_access.module:

/**
 * Implements hook_node_update().
 */
function book_access_node_update($node) {
  BookAccess::deleteGrants($node->nid);
}

It's pretty clear what it's doing, but the question is why? Can anyone think of why it's a good idea to delete all grants when a node is updated?

saratt’s picture

I tried deleting that function and the module does not do that(resetting the permissions after a node is edited and saved) anymore, though I am not sure deleting that is the right thing.

But, I have found a different problem. No matter I assign or remove a role/user from viewing a book, the role/user is always able to see the book. Did any of you guys face this?

Thanks.

nicksanta’s picture

@st455 I found that problem too, as well as the one this issue is about.

thelee’s picture

Super critical bug - this pretty much kills book_access in any reasonable environment.

Does no one have any idea what all grants are being deleted upon an update? I'm going to go ahead and comment out that line in my own code.

thelee’s picture

anyone know how to 'take control' of a project (if possible)? it doesn't seem like the two current maintainers are very active with this anymore.

thelee’s picture

FYI - this the patch I've made for 7.x-2.x. I can't figure out why this was coded like this, no one else can, I figure it was a mistaken copy paste from book_access_node_delete. One of our sites has been running with this patch for a while with no problems, so no side effects I can think of.

thelee’s picture

I'm actually going to create some test cases for this before this becomes a formal commit, just to follow some best practices.

thelee’s picture

Assigned: Unassigned » thelee
thelee’s picture

This is the final patch that I've applied, complete with a test case that broke and was fixed by the removal of hook_node_update.

thelee’s picture

Status: Active » Fixed
thelee’s picture

this is now in 7.x-2.x-dev (pending drupal.org code pull) and is pending merge to release contingent on other release blockers here: http://drupal.org/node/1457812

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.