You are here

function fillpdf_file_download_access_alter in FillPDF 7

Implements hook_file_download_access_alter().

File

./fillpdf.module, line 238

Code

function fillpdf_file_download_access_alter(&$grants, $file_item, $entity_type, $entity) {

  // If the user has the Publish All PDFs permission but does not have access,
  // to the entity used to generate the file, another module might have denied
  // them access in hook_file_download(). However, if they have Publish All
  // PDFs, then we would have allowed them to generate the file anwyay. We
  // therefore do a second check here and grant access definitively.
  if (user_access('publish all pdfs') && !!fillpdf_file_download($file_item['uri'])) {
    $grants['fillpdf'] = TRUE;
  }
}