You are here

function media_acquiadam_asset_access in Media: Acquia DAM 7

Access callback for the menu system.

Parameters

string $op: The operation being performed.

AcquiaDAM_Assets_AbstractAsset $asset: The asset to check permissions for.

object $account: The account to check permissions against.

Return value

bool If the account has permissions to perform the given operation.

1 call to media_acquiadam_asset_access()
media_acquiadam_file_entity_access in ./media_acquiadam.module
Implements hook_file_entity_access().
2 string references to 'media_acquiadam_asset_access'
media_acquiadam_browser_menu in modules/media_acquiadam_browser/media_acquiadam_browser.module
Implements hook_menu().
media_acquiadam_menu in ./media_acquiadam.module
Implements hook_menu().

File

./media_acquiadam.module, line 274

Code

function media_acquiadam_asset_access($op, AcquiaDAM_Assets_AbstractAsset $asset, $account = NULL) {
  if (empty($account)) {
    $account = $GLOBALS['user'];
  }
  $rights =& drupal_static(__FUNCTION__, []);
  if (isset($rights[$account->uid][$asset['id']][$op])) {
    return $rights[$account->uid][$asset['id']][$op];
  }
  elseif ('view' == $op) {
    return $rights[$account->uid][$asset['id']][$op] = $asset
      ->isExpired() ? user_access('view expired acquiadam assets', $account) : user_access('view acquiadam assets', $account);
  }
  elseif ('refresh' == $op) {
    return $rights[$account->uid][$asset['id']][$op] = user_access('refresh acquiadam assets', $account);
  }
  return FALSE;
}