You are here

function feeds_tamper_access in Feeds Tamper 7

Same name and namespace in other branches
  1. 8.2 legacy/feeds_tamper.inc \feeds_tamper_access()
  2. 6 feeds_tamper.inc \feeds_tamper_access()

Menu access callback.

Parameters

string|FeedsImporter $importer: The importer or importer id being tampered with.

string|stdClass $instance: (optional) If set, the importer attached to $instance will be tried first. Defaults to NULL.

Return value

bool TRUE if the user has acces, FALSE if not.

1 call to feeds_tamper_access()
feeds_tamper_ui_form_feeds_ui_overview_form_alter in feeds_tamper_ui/feeds_tamper_ui.module
Implements hook_form_FORM_ID_alter().
1 string reference to 'feeds_tamper_access'
feeds_tamper_ui_menu in feeds_tamper_ui/feeds_tamper_ui.module
Implements hook_menu().

File

./feeds_tamper.inc, line 285
Version agnostic parts of feeds_tamper.module.

Code

function feeds_tamper_access($importer, $instance = NULL) {
  if (isset($instance)) {
    if (is_object($instance)) {
      $importer = $instance->importer;
    }
    else {
      $importer = feeds_tamper_load_instance($instance)->importer;
    }
  }
  elseif (is_object($importer)) {
    $importer = $importer->id;
  }

  // Verify actual input if above failed.
  if ($importer) {

    // Check for permissions, otherwise return FALSE.
    if (user_access('administer feeds_tamper') || user_access('tamper ' . $importer)) {
      return TRUE;
    }
  }
  return FALSE;
}