You are here

function commerce_order_commerce_line_item_access in Commerce Core 7

Implements hook_commerce_line_item_access().

Line items have order_id properties, but since there is no dependency from the Line Item module to Order, we perform access checks for line items attached to orders through this hook.

File

modules/order/commerce_order.module, line 905
Defines the core Commerce order entity and API functions to manage orders and interact with them.

Code

function commerce_order_commerce_line_item_access($op, $line_item, $account) {

  // If the line item references an order...
  if ($order = commerce_order_load($line_item->order_id)) {

    // Return the account's access to update the order.
    return commerce_order_access('update', $order, $account);
  }
}