You are here

function commerce_customer_ui_customer_profile_add_any_access in Commerce Core 7

Access callback: determine if the user can create any type of profile.

1 string reference to 'commerce_customer_ui_customer_profile_add_any_access'
commerce_customer_ui_menu in modules/customer/commerce_customer_ui.module
Implements hook_menu().

File

modules/customer/commerce_customer_ui.module, line 106

Code

function commerce_customer_ui_customer_profile_add_any_access() {

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

  // Check the user's access on a profile type basis.
  foreach (commerce_customer_profile_types() as $type => $profile_type) {
    if (commerce_customer_profile_access('create', commerce_customer_profile_new($type))) {
      return TRUE;
    }
  }
  return FALSE;
}