When updating the permissions of a book, an sloppy API usage creates duplicated entries in the book_access table:
user warning: Entrada duplicada '1-1' para la clave 'PRIMARY' query: INSERT INTO simpletest836016book_access (nid, rid, grant_view, grant_update, grant_delete) VALUES (1, 1, 1, 1, 1) in
Also, when viewing a book page, a mysql error is generated when trying to verify if user has permissions to add child pages. As in the other, the testcase will include test for these errors.
As both are database errors, I've created an issue for them. This patch fixes both (the test case includes tests for both errors too).
Comments
Comment #1
ilo commentedI've modified the book_access_nodeapi() function to improve its performance also.
By the way, what is the purpose of line 211: $node->book['depth'] < MENU_MAX_DEPTH ?? should not this be controlled by the book module?
Comment #2
ilo commentedI just found enough changes for the API usage to have its own patch, so I'm reverting this patch to only hook_nodeapi issues (forget previous).
This patch fixes the database query error and keep performance improvements for hook_nodeapi call.
Note: I promise, no more patch updates for this issue ;)
Comment #3
avpadernoThe code has been changed, and committed in CVS.