You are here

function merci_access in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6

Same name and namespace in other branches
  1. 6.2 merci.module \merci_access()

Implementation of hook_access().

File

./merci.module, line 2165
MERCI - Managed Equipment Reservation Checkout and Inventory

Code

function merci_access($op, $node, $account) {
  global $user;
  $type = isset($node->type) ? $node->type : $node;
  $uid = isset($node->uid) ? $node->uid : FALSE;
  if ($type == 'merci_reservation') {

    // MERCI admins and users working with their own reservations have all access.
    if (user_access('administer MERCI')) {
      return TRUE;
    }
    elseif (user_access('create reservations')) {
      if ($uid === FALSE || $uid == $account->uid) {
        return TRUE;
      }
    }
    return FALSE;
  }
}