You are here

function library_action_access in Library 6

Same name and namespace in other branches
  1. 5.2 library.module \library_action_access()
  2. 6.2 library.module \library_action_access()
1 string reference to 'library_action_access'
library_menu in ./library.module
Implementation of hook_menu().

File

./library.module, line 89

Code

function library_action_access($aid) {
  $may_view_patron = FALSE;
  if (user_access('view patron content')) {
    $may_view_patron = TRUE;
  }
  else {
    global $user;
    $user_patron = patron_load_by_uid($user->uid);
    if (is_object($user_patron)) {
      $may_view_patron = TRUE;
    }
  }
  if (user_access('administer transactions') && $may_view_patron) {
    return TRUE;
  }
  elseif ($aid && $may_view_patron) {
    $action = library_get_action($aid);
    if ($action->name) {
      return user_access('submit library ' . $action->name);
    }
  }
  return FALSE;
}