You are here

function biblio_access in Bibliography Module 6.2

Same name and namespace in other branches
  1. 5 biblio.module \biblio_access()
  2. 6 biblio.module \biblio_access()
  3. 7.3 biblio.module \biblio_access()
  4. 7 biblio.module \biblio_access()
  5. 7.2 biblio.module \biblio_access()

Implements hook_access().

Node modules may implement node_access() to determine the operations users may perform on nodes. This example uses a very common access pattern.

15 calls to biblio_access()
biblio_bibtex_biblio_export_link in modules/bibtexParse/biblio_bibtex.module
Creates a link to export a node (or view) in BibTEX format
biblio_handler_citation::render in views/biblio_handler_citation.inc
biblio_import_form in includes/biblio.import.export.inc
Defines a form used to import files into biblio.
biblio_link in ./biblio.module
Implements hook_link().
biblio_ris_biblio_export_link in modules/RIS/biblio_ris.module
Creates a link to export a node (or view) in ris format

... See full list

1 string reference to 'biblio_access'
biblio_menu in ./biblio.module
Implements hook_menu().

File

./biblio.module, line 500
Main file for Drupal module biblio.

Code

function biblio_access($op, $node = '', $user = '') {
  switch ($op) {
    case 'create':
      return user_access('create biblio');
    case 'delete':
    case 'update':
      if (user_access('edit all biblio entries')) {
        return TRUE;
      }
      if (!isset($user->uid)) {
        return;
      }
      if (user_access('edit own biblio entries') && $user->uid == $node->uid) {
        return TRUE;
      }
      break;
    case 'view':
      if (variable_get('biblio_view_only_own', 0) && $user->uid != $node->uid) {
        return FALSE;
      }
      break;
    case 'admin':
      return user_access('administer biblio');
    case 'import':
      return user_access('import from file');
    case 'export':
      return user_access('show export links');
    case 'edit_author':
      if (user_access('administer biblio') || user_access('edit biblio authors')) {
        return TRUE;
      }
      break;
    case 'download':
      if (user_access('show download links')) {
        return TRUE;
      }
      if (!isset($user->uid)) {
        return;
      }
      if (user_access('show own download links') && $user->uid == $node->uid) {
        return TRUE;
      }
      break;
    case 'rss':
      return variable_get('biblio_rss', 0);
    default:
      break;
  }
  return;
}