You are here

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

Implements hook_permission().

File

modules/rooms_pricing/rooms_pricing.module, line 16
Manages pricing for Bookable Units and displaying dates on the jquery FullCalendar plugin.

Code

function rooms_pricing_permission() {
  $permissions = array(
    'administer rooms_unit pricing' => array(
      'title' => t('Administer unit pricing'),
      'description' => t('Allows users to access bulk availability operations for bookable units.'),
      'restrict access' => TRUE,
    ),
    'update pricing own rooms_unit entities' => array(
      'title' => t('Edit pricing own bookable units of any type'),
    ),
    'update pricing any rooms_unit entity' => array(
      'title' => t('Edit pricing 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 pricing own rooms_unit entities of bundle ' . $type_name => array(
        'title' => t('Edit pricing own %type_name bookable units', array(
          '%type_name' => $type->label,
        )),
      ),
      'update pricing any rooms_unit entity of bundle ' . $type_name => array(
        'title' => t('Edit pricing any %type_name bookable unit', array(
          '%type_name' => $type->label,
        )),
      ),
    );
  }
  return $permissions;
}