You are here

function _book_helper_access in Book helper 7

Same name and namespace in other branches
  1. 6 book_helper.module \_book_helper_access()

Menu callback access; Determine if the order book tab is accessible.

1 string reference to '_book_helper_access'
book_helper_menu in ./book_helper.module
Implements hook_menu().

File

./book_helper.module, line 123
Improves Drupal's core book module's functionality.

Code

function _book_helper_access($node) {
  global $user;
  $is_node_book = isset($node->book['bid']) && $node->book['bid'] == $node->nid;
  if (!$is_node_book) {
    return FALSE;
  }

  // Allow users to administer their own books using 'administer own book outlines'.
  if (user_access('administer own book outlines') && $node->uid === $user->uid) {
    return TRUE;
  }
  return _book_outline_access($node);
}