book_access

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/book/book.module, строка 31

Версии
5
book_access($op, $node)

Реализация метода hook_access()

▾ 2 функции вызывают book_access()

book_link in modules/book/book.module
Реализация hook_link().
hook_link in developer/hooks/core.php
Определяет внутренние ссылки Drupal.

Код

<?php
function book_access($op, $node) {
  global $user;

  if ($op == 'create') {
    // Only registered users can create book pages. Given the nature
    // of the book module this is considered to be a good/safe idea.
    return user_access('create book pages');
  }

  if ($op == 'update') {
    // Only registered users can update book pages. Given the nature
    // of the book module this is considered to be a good/safe idea.
    // One can only update a book page if there are no suggested updates
    // of that page waiting for approval. That is, only updates that
    // don't overwrite the current or pending information are allowed.

    if (user_access('edit book pages') || ($node->uid == $user->uid && user_access('edit own book pages'))) {
      return TRUE;
    }
    else {
       // do nothing. node-access() will determine further access
    }
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему