Hi,

it seems there is a little incompatibility with "book access". If I create a book in the way "book made simple" intends it (auto-create main book page) the author's permission is messed up and everyone can view the book's main page (no matter what defaults are set with book access) until the permissions are set again via book access... Here is the problem described more detailed

Comments

MarcElbichon’s picture

Perhaps this is due to the fact that the two modules are overriding outline menu access.
As i don't know book_access and your configuration, can you remove in book_made_simple.module in book_made_simple_menu() function these lines :

  $items['node/%node/outline'] = array(
    'title' => 'Outline',
    'page callback' => 'book_outline',
    'page arguments' => array(1),
    'access callback' => 'book_made_simple_is_outline_access',
    'access arguments' => array(1),
    //'access arguments' => array("show core Outline tab"),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10  ,
    'file' => 'book.pages.inc',
    'file path' => drupal_get_path('module', 'book'),
  );

Clear your cache and retry

Zippy’s picture

Sorry, the issue is still not solved.
I the author's permissions are still not shown up and everyone can see the book outline.
Thank you for your help!

regards

MarcElbichon’s picture

I'm going on vacation until January 2d
I'll have a look to this issue on my return.

Zippy’s picture

Thanks a lot and happy Holidays!

thelee’s picture

hey i'm the maintainer for book_access, just wanted to chime in here.

i'm going on holidays too, but Marc if you need any assistance on my end to figure it out (i'd like book_access to be a good citizen to other modules, code-wise), i'll be glad to help.

MarcElbichon’s picture

Any help is always appreciated !
I will contact you on my return.

MarcElbichon’s picture

StatusFileSize
new1.16 KB

Problem was due to the fact both modules redefine outline access function.
I've modified BMS to use hook_menu_alter rather than hook_registry_alter.
These modifications have been commited to dev but i post patch too.

But there's another problem. As both module are using hook_menu_alter, book_access weight (actually 2) must be greater than BMS weight (actually 10) to override BMS actions.

BMS needs to be high to be sure hook_node_insert is called after all modules hooks.
@thelee, does Book_access can be set to greater than 10 ?
If yes, the weight of book_access must changed in database for the moment.
Maybe can we work with @thelee for a better integration.

EDIT : Don't forget to clear caches.

thelee’s picture

Yes, I believe it would be fairly trivial to make the change to the weight. I'll have to take a look at it later when things calm down a bit here.

Zippy’s picture

Hi,

I downloaded the newest dev version of book made simple module an installed it. Now I have the following errors caused by bms (if I uninstall the module the errors are gone):
- The following message on every node page :
Notice: Undefined index: access in _menu_translate() (line 792 of /var/www/MyProject/includes/menu.inc).
Notice: Undefined index: access in menu_local_tasks() (line 1970 of /var/wwwMyProject/includes/menu.inc).
- I can see the "reorder tab" on every node page (also on nodes that are not part of the book)
If I click on the "reorder the book" tab I get this message:
Notice: Undefined property: stdClass::$book in book_made_simple_reorder() (line 134 of /var/www/MyProject/sites/all/modules/book_made_simple/book_made_simple.module).

I appreciate your hard work!

regards

MarcElbichon’s picture

Have you clear caches ?
Can you give me book_access and bms permissions ?

Zippy’s picture

I've cleared the cache uninstalled/installed the new version of bms. The book access permissions of a new book are still only granted for the administrator and not to the author (as intended). Only the admin has all bms permissions granted. I'll have do do more tests...

MarcElbichon’s picture

Can you post me permissions of

  • Administer book outlines
  • Show (checked) or hide (unchecked) core book reorder tab,
  • Show (checked) or hide (unchecked) core Outline tab
  • Show (checked) or hide (unchecked) outline section in form elements.
Zippy’s picture

Administer book outlines ->admin (yes) [core book module]
Show (checked) or hide (unchecked) core book reorder tab, ->admin (yes)
Show (checked) or hide (unchecked) core Outline tab ->admin (yes)
Show (checked) or hide (unchecked) outline section in form elements. ->admin (yes)

I can see the "reorder tab" only with the role 'admin' but I think it should be only available on nodes associated with a book... I will load a backup and do some more tests.

MarcElbichon’s picture

It is normal that only admin can see Reorder because Show (checked) or hide (unchecked) core book reorder tab perm is only checked for admin role.
You said in #9 you see reorder tab in all pages. This happens only for admin role ?

Zippy’s picture

I granted all the permissions of book core, book access and bms to authenticated users but all the problems seem to be concentrated only on the admin's role...

MarcElbichon’s picture

For reorder tab problem, replace in book_made_simple.module (line 108)

  if (user_access('administer books')) return true;
  if (isset($node->book) && $node->book['bid'] > 0) {

by

  if (isset($node->book) && $node->book['bid'] > 0) {
    if (user_access('administer books')) return true;
MarcElbichon’s picture

There was a bug due to refactoring.
Can you replace in book_made_simple.module line 750

    $items['node/%node/outline']['access callback'] = 'is_outline_access';

By

    $items['node/%node/outline']['access callback'] = 'book_made_simple_is_outline_access';
Zippy’s picture

Hi,

I replaced the 3 lines of code and the "reorder tab"-Problem seems to be fully solved now! Thank you very much for this.

Two of my problems remain further on:
- The following message on every node page :
Notice: Undefined index: access in _menu_translate() (line 792 of /var/www/MyProject/includes/menu.inc).
Notice: Undefined index: access in menu_local_tasks() (line 1970 of /var/wwwMyProject/includes/menu.inc).

- I grant all permissions to the author by default (via book access) but if I create a new book with bms enabled the author gets no permissions granted. I tested this earlier and it seems to be a problem caused by bms...

MarcElbichon’s picture

1) I can't reproduce problem. Maybe corrected by #17. Don't forget to clear menu caches
2) Have you applied this patch ( http://drupal.org/node/1871124#comment-6865556 )?

Zippy’s picture

Okay,

I solved the error message problem by executing "cache_clear_all(NULL, 'cache_menu');"
Is there a good module to clear the caches? I used the standard functionality and it didn't work for me... But now its fine. I used the latest dev version of book access. I will test if I have to apply the patch again.... Thanks a lot!

MarcElbichon’s picture

Zippy’s picture

Okay,
looks far better now!
Thelee's patch is already implemented in the newest version I am using.
If I set the author's default permissions (/admin/content/book/settings) via book access and disable bms every thing works well but if I enable the bms module the author get no permissions...
I tested this (two weeks ago) with a complete new drupal and only book access and bms involved...

MarcElbichon’s picture

I had the same problem when i tried Book Access. I had to rebuild all node permissions in admin/content/book/settings by click on "Save and reset all books to defaults" button

Zippy’s picture

I did that and the problem is indeed solved for every OLD book that existed before. But if I create a new book the problem still remains...

MarcElbichon’s picture

Looks fine for me.
How do you see author has no permission ?

Zippy’s picture

1. Set the author to have full permissions via admin/content/book/settings (first row)
2. Create a new book and save.
3. Go to the book's root and select the tab "book access"
There you can see permissions of the current book. The author has no permissions...

MarcElbichon’s picture

StatusFileSize
new76.33 KB

Works for me (for admin or authenticated user).
See my permissions in screenshot

MarcElbichon’s picture

Have you changed weight of book_access to 12 by updating system table ?

Zippy’s picture

Yor screenshot shows the 'normal' permissions. Maybe we misunderstand each other. Book access has it's own set of default book permissions that can be set under admin/content/book/settings (at the bottom of the page). There I configure the author's permissions.

Have you changed weight of book_access to 12 by updating system table ?

no!Do I need this adjustment?

MarcElbichon’s picture

Yes. You must do this. Don't forget to rebuild cache

Zippy’s picture

You are my hero! Everything works fine now! If there is something I can do for you please let me know!

Thank you very much for all the support!

MarcElbichon’s picture

Status: Active » Closed (fixed)

Glad to have helped you !

thelee’s picture

Sorry it took me a while, but this is the patch that I'll be using for book_access's side (basically just changing the weight in hook_install).

MarcElbichon’s picture

Great.
Many thanks for your help

Marc

MarcElbichon’s picture

Issue summary: View changes

correction

aporie’s picture

Issue summary: View changes
StatusFileSize
new75.5 KB
new83.05 KB

Hi,

I'm using the two devs version (book access and BMS) and I still have this problem.

I want book access to control all right on books, and the only thing I can do is to allow users to show or not theirs books to the others (visibility on book is working).

I definitily want to allow users to have possibility to choose who can edit and manage book access settings for each book they own.

The facts are :

- When I check "content type can only be created inside a book" (in the content type settings for child page) to avoid people to add child page to books they are not allowed to, nobody is allowed to add child page (even if it's the author of the book). Moreover, outline tab is visible on each book page whereas I want users to see the outline tab only for the books they have right to add child to (with book access).

- When I check "only creator can add child pages" (in the content type settings for book page), the outline tab is visible for the author and no one else, but if I grant access to somebody in book access to add child page, he can't see the outline tab.

I know my problem seems to be complicated, moreover it's difficult to me to explain it in my native langage it's even more difficult to explain it in english.

Hope somebody could help me, knowing those previously patchs should have resolved my problem, which is similar to this topic.

I can tell you more about my problem if needed.

joseph.olstad’s picture

for those hitting this, you'd need to uninstall book_access, apply the above patch to book_access and then re-install.

with that said, surely can come up with a better patch, one that includes hook_update also

The patch seems like a reasonable and simple solution, could be improved by adding a hook_update