You are here

function feeds_access in Feeds 6

Same name and namespace in other branches
  1. 8.2 feeds.module \feeds_access()
  2. 7.2 feeds.module \feeds_access()
  3. 7 feeds.module \feeds_access()

Menu access callback.

Parameters

$action: The action to be performed. Possible values are:

  • import
  • clear

$param: Node object or FeedsImporter id.

Related topics

1 string reference to 'feeds_access'
feeds_menu in ./feeds.module
Implementation of hook_menu().

File

./feeds.module, line 247
Feeds - basic API functions and hook implementations.

Code

function feeds_access($action, $param) {
  if (!in_array($action, array(
    'import',
    'clear',
  ))) {

    // If $action is not one of the supported actions, we return access denied.
    return FALSE;
  }
  if (is_string($param)) {
    $importer_id = $param;
  }
  elseif ($param->type) {
    $importer_id = feeds_get_importer_id($param->type);
  }

  // Check for permissions if feed id is present, otherwise return FALSE.
  if ($importer_id) {
    if (user_access('administer feeds') || user_access($action . ' ' . $importer_id . ' feeds')) {
      return TRUE;
    }
  }
  return FALSE;
}