You are here

function is_reorder_access in Book made simple 6.3

Return access rights for book

1 call to is_reorder_access()
book_made_simple_form_alter in ./book_made_simple.module
Implementation of hook_form_alter().
1 string reference to 'is_reorder_access'
book_made_simple_menu in ./book_made_simple.module
Implementation of hook_menu().

File

./book_made_simple.module, line 86

Code

function is_reorder_access($node = NULL) {
  if (user_access('administer books')) {
    return true;
  }
  if (isset($node->book) && $node->book['bid'] > 0) {
    if (!_book_outline_access($node) || !user_access('show book reorder tab') || !book_made_simple_creator_only_access($node)) {
      return false;
    }

    // Cheching permissions according to rules/
    $book = $node->book;
    $linkVisibilty = variable_get('book_made_simple_reorder_link', "0");
    $allowed = true;
    if ($linkVisibilty == "0") {
      $mainBook = $book;
      if ($book['nid'] != $book['bid']) {
        $mainBook = node_load($book['bid'])->book;
      }
      $allowed = count(book_toc($mainBook['bid'], array(), 9999)) > 2;
    }
    return $allowed;
  }
  return false;
}