You are here

function bat_booking_add_access in Booking and Availability Management Tools for Drupal 7

Access callback: Checks whether the user has permission to add a booking.

Return value

bool TRUE if the user has add permission, otherwise FALSE.

1 string reference to 'bat_booking_add_access'
BatBookingUIController::hook_menu in modules/bat_booking/bat_booking.admin.inc
Overrides hook_menu() defaults.

File

modules/bat_booking/bat_booking.module, line 173

Code

function bat_booking_add_access() {
  if (user_access('administer bat_booking_type entities')) {
    return TRUE;
  }
  $bundles = bat_booking_get_types();
  foreach ($bundles as $bundle) {
    if (bat_booking_access('create', bat_booking_create(array(
      'type' => $bundle->type,
      'uid' => 0,
    )))) {
      return TRUE;
    }
  }
  return FALSE;
}