You are here

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

Update permission names for rooms_unit entity management.

File

modules/rooms_unit/rooms_unit.install, line 623
Sets up the base table for our entity and a table to store information about the entity types.

Code

function rooms_unit_update_7010() {

  // Load utility functions.
  module_load_install('rooms');
  $map = array(
    'administer bookable unit types' => 'administer rooms_unit_type entities',
    'administer bookable units' => 'bypass rooms_unit entities access',
  );
  $entity_info = entity_get_info('rooms_booking');
  foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
    $map['view any ' . $bundle_name . ' bookable unit'] = 'view any rooms_unit entity of bundle ' . $bundle_name;
    $map['edit any ' . $bundle_name . ' bookable unit'] = 'update any rooms_unit entity of bundle ' . $bundle_name;
  }
  commerce_update_rename_permissions($map);
  return t('Role and custom View permissions updated for order entity management. Access checks in modules and permissions on default Views must be updated manually.');
}