You are here

function biblio_access in Bibliography Module 5

Same name and namespace in other branches
  1. 6.2 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()

Implementation of 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.

6 calls to biblio_access()
biblio_form_import in ./biblio.module
biblio_link in ./biblio.module
Implementation of hook_link().
biblio_show_node in ./biblio.module
biblio_show_results in ./biblio.module
theme_biblio_list in ./biblio.module

... See full list

File

./biblio.module, line 93

Code

function biblio_access($op, $node = "") {
  global $user;
  switch ($op) {
    case 'create':
      return user_access('create biblio');
    case 'import':
      return user_access('import from file');
    case 'export':
      return user_access('show export links');
    case 'download':
      if (user_access('show download links') || user_access('show own download links') && $user->uid == $node->uid) {
        return TRUE;
      }
      break;
    case 'update':
    case 'delete':
      if (user_access('edit all biblio entries') || 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;
    default:
  }
}