You are here

function farm_import_farm_access_perms in farmOS 7

Implements hook_farm_access_perms().

File

modules/farm/farm_import/farm_import.module, line 33
Farm import module.

Code

function farm_import_farm_access_perms($role) {
  $perms = array();

  // Load the list of farm roles.
  $roles = farm_access_roles();

  // If this role has 'config' access, grant access to Feeds importers.
  if (!empty($roles[$role]['access']['config'])) {

    // Add permissions for asset importers.
    $asset_types = farm_asset_types();
    foreach ($asset_types as $type) {
      $perms[] = 'import farm_asset_' . $type->type . ' feeds';
    }

    // Add permissions for log importers.
    $log_types = log_types();
    foreach ($log_types as $type) {
      $perms[] = 'import log_' . $type->type . ' feeds';
    }
  }
  return $perms;
}