You are here

function rooms_availability_permission in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Implements hook_permission().

File

modules/rooms_availability/rooms_availability.module, line 15
Manages availability for Bookable Units and displaying dates on the jquery FullCalendar plugin.

Code

function rooms_availability_permission() {
  $permissions = array(
    'administer rooms_unit availability' => array(
      'title' => t('Administer unit availability'),
      'description' => t('Allows users to access bulk availability operations for bookable units.'),
      'restrict access' => TRUE,
    ),
    'view anonymous availability information' => array(
      'title' => t('View anonymous availability information'),
      'description' => t('Allow users to view anonymous availability info (especially via availability reference field).'),
    ),
    'view named availability information' => array(
      'title' => t('View named availability information'),
      'description' => t('Allow users to view named availability info (especially via availability reference field).'),
    ),
    'view past availability information' => array(
      'title' => t('View past availability information'),
      'description' => t('Allow users to view availability info in the past (especially via availability reference field).'),
    ),
    'update availability own rooms_unit entities' => array(
      'title' => t('Edit availability own bookable units of any type'),
    ),
    'update availability any rooms_unit entity' => array(
      'title' => t('Edit availability any bookable unit of any type'),
    ),
  );

  // Generate permissions per room type.
  foreach (rooms_unit_get_types() as $type) {
    $type_name = check_plain($type->type);
    $permissions += array(
      'update availability own rooms_unit entities of bundle ' . $type_name => array(
        'title' => t('Edit availability own %type_name bookable units', array(
          '%type_name' => $type->label,
        )),
      ),
      'update availability any rooms_unit entity of bundle ' . $type_name => array(
        'title' => t('Edit availability any %type_name bookable unit', array(
          '%type_name' => $type->label,
        )),
      ),
    );
  }
  return $permissions;
}