You are here

function commerce_product_ui_product_add_any_access in Commerce Core 7

Access callback: determines if the user can create any type of product.

1 string reference to 'commerce_product_ui_product_add_any_access'
commerce_product_ui_menu in modules/product/commerce_product_ui.module
Implements hook_menu().

File

modules/product/commerce_product_ui.module, line 135

Code

function commerce_product_ui_product_add_any_access() {

  // Grant automatic access to users with administer products permission.
  if (user_access('administer commerce_product entities')) {
    return TRUE;
  }

  // Check the user's access on a product type basis.
  foreach (commerce_product_types() as $type => $product_type) {
    if (commerce_product_access('create', commerce_product_new($type))) {
      return TRUE;
    }
  }
  return FALSE;
}