You are here

public function GeneratePdfAccessCheck::access in PDF using mPDF 8.2

Parameters

AccountInterface $account:

Node|NULL $node:

Return value

AccessResultAllowed|AccessResultForbidden

File

src/Access/GeneratePdfAccessCheck.php, line 24

Class

GeneratePdfAccessCheck
Class GeneratePdfAccessCheck @package Drupal\pdf_using_mpdf\Access

Namespace

Drupal\pdf_using_mpdf\Access

Code

public function access(AccountInterface $account, Node $node = NULL) {
  $permission = 'generate ' . $node
    ->getType() . ' pdf';
  return $account
    ->hasPermission($permission) ? AccessResult::allowed() : AccessResult::forbidden();
}