You are here

function commerce_pricelist_entity_access in Commerce Pricelist 7

Parameters

$op:

$entity:

$account: _type

Return value

bool

1 string reference to 'commerce_pricelist_entity_access'
commerce_pricelist_entity_info in ./commerce_pricelist.module
Implements hook_entity_info().

File

./commerce_pricelist.module, line 571
Implements the basic functionality required for price lists

Code

function commerce_pricelist_entity_access($op, $entity, $account, $entity_type) {
  global $user;
  $account = isset($account) ? $account : $user;

  // There are no separate permissions for pricelist items so handle as list.
  $entity_type = 'commerce_pricelist_list';
  if ($op == 'view') {
    return user_access('view any ' . $entity_type . ' entity', $account);
  }
  if ($op == 'create') {
    return user_access('create ' . $entity_type . ' entities', $account);
  }
  if ($op == 'edit') {
    return user_access('edit any ' . $entity_type . ' entity', $account);
  }
  if ($op == 'update') {
    return user_access('edit any ' . $entity_type . ' entity', $account);
  }
  if ($op == 'delete') {
    return user_access('edit any ' . $entity_type . ' entity', $account);
  }
  return FALSE;
}