You are here

function commerce_customer_update_7000 in Commerce Core 7

Update permission names for customer profile entity management.

File

modules/customer/commerce_customer.install, line 193

Code

function commerce_customer_update_7000() {

  // Load utility functions.
  module_load_install('commerce');
  $map = array(
    'administer customer profiles' => 'administer commerce_customer_profile entities',
    'access customer profiles' => 'view any commerce_customer_profile entity',
  );
  $entity_info = entity_get_info('commerce_customer_profile');
  foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
    $map['create ' . $bundle_name . ' customer profiles'] = 'create commerce_customer_profile entities of bundle ' . $bundle_name;
    $map['edit any ' . $bundle_name . ' customer profile'] = 'edit any commerce_customer_profile entity of bundle ' . $bundle_name;
    $map['edit own ' . $bundle_name . ' customer profiles'] = 'edit own commerce_customer_profile entities 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.');
}