You are here

function _commerce_file_field_view_access_license in Commerce File 7

Returns TRUE if user has view access to commerce_file fields on a license instance

1 call to _commerce_file_field_view_access_license()
_commerce_file_field_view_access in ./commerce_file.module
Returns TRUE if a user has view access to commerce_file fields on any field instance

File

./commerce_file.module, line 937
Provides integration of file licenses with Commerce

Code

function _commerce_file_field_view_access_license($entity, $account) {
  $access = FALSE;
  if (!empty($entity) && $entity
    ->access('view', $account)) {
    if ($entity->uid != $account->uid || $entity
      ->is_allowed()) {

      // provide link for admins withs view access -OR- owner if entity state is allowed
      $access = TRUE;
    }
  }
  elseif (commerce_file_license_admin_access('view', $account)) {
    $access = TRUE;
  }
  return $access;
}