You are here

function assets_entity_access_callback in Asset 7

Access callback for the entity API.

1 string reference to 'assets_entity_access_callback'
asset_entity_info in ./asset.module
Implements hook_entity_info().

File

./asset.module, line 167
Asset module.

Code

function assets_entity_access_callback($op, $entity = NULL, $account = NULL) {
  switch ($op) {
    case 'view':
      return empty($entity) ? user_access('administer assets', $account) : user_access('access content', $account);
      break;
    case 'update':
    case 'edit':
      return !empty($entity->type) ? asset_edition_access($entity->type, $account) : FALSE;
      break;
    case 'delete':
      return !empty($entity->type) ? asset_delete_access($entity->type, $account) : FALSE;
      break;
    default:
      return user_access('administer assets', $account);
      break;
  }
}