You are here

function commerce_product_update_7101 in Commerce Core 7

Update permission names for product entity management.

File

modules/product/commerce_product.install, line 211

Code

function commerce_product_update_7101() {

  // Load utility functions.
  module_load_install('commerce');
  $map = array(
    'administer products' => 'administer commerce_product entities',
    'access products' => 'view any commerce_product entity',
  );
  $entity_info = entity_get_info('commerce_product');
  foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
    $map['create ' . $bundle_name . ' products'] = 'create commerce_product entities of bundle ' . $bundle_name;
    $map['edit any ' . $bundle_name . ' product'] = 'edit any commerce_product entity of bundle ' . $bundle_name;
    $map['edit own ' . $bundle_name . ' products'] = 'edit own commerce_product entities of bundle ' . $bundle_name;
  }
  commerce_update_rename_permissions($map);
  return t('Role and custom View permissions updated for product entity management. Access checks in modules and permissions on default Views must be updated manually.');
}