You are here

function feeds_tamper_access in Feeds Tamper 8.2

Same name and namespace in other branches
  1. 6 feeds_tamper.inc \feeds_tamper_access()
  2. 7 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 legacy/feeds_tamper_ui/feeds_tamper_ui.module
Implements hook_form_FORM_ID_alter().

File

legacy/feeds_tamper.inc, line 38
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;
}