You are here

function AnalyticsServiceExportUI::access in Analytics 7

Menu callback to determine if an operation is accessible.

This function enforces a basic access check on the configured perm string, and then additional checks as needed.

Parameters

$op: The 'op' of the menu item, which is defined by 'allowed operations' and embedded into the arguments in the menu item.

$item: If an op that works on an item, then the item object, otherwise NULL.

Return value

TRUE if the current user has access, FALSE if not.

Overrides ctools_export_ui::access

1 call to AnalyticsServiceExportUI::access()
AnalyticsServiceExportUI::build_operations in lib/export_ui/AnalyticsServiceExportUI.class.php
Builds the operation links for a specific exportable item.

File

lib/export_ui/AnalyticsServiceExportUI.class.php, line 5

Class

AnalyticsServiceExportUI

Code

function access($op, $item) {

  // Only can add or import new services if there are available services that
  // can be added.
  if (in_array($op, array(
    'add',
    'import',
  )) && !analytics_service_add_service_options()) {
    return FALSE;
  }

  // Disable cloning entirely.
  if ($op == 'clone') {
    return FALSE;
  }
  if (!empty($item->locked)) {
    return FALSE;
  }
  return parent::access($op, $item);
}