function _rooms_booking_add_access in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 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.
See also
1 string reference to '_rooms_booking_add_access'
- RoomsBookingUIController::hook_menu in modules/
rooms_booking/ rooms_booking.admin.inc - Overrides hook_menu() defaults.
File
- modules/
rooms_booking/ rooms_booking.module, line 594 - Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.
Code
function _rooms_booking_add_access() {
if (user_access('administer rooms_booking_type entities')) {
// There are no booking types defined that the user has permission to create
// but the user does have the permission to administer the content types, so
// grant them access to the page anyway.
return TRUE;
}
$types = rooms_booking_get_types();
foreach ($types as $type) {
if (rooms_booking_access('create', rooms_booking_create(array(
'type' => $type->type,
'uid' => 0,
)))) {
return TRUE;
}
}
return FALSE;
}