You are here

class GeneratePdfAccessCheck in PDF using mPDF 8.2

Class GeneratePdfAccessCheck @package Drupal\pdf_using_mpdf\Access

Hierarchy

Expanded class hierarchy of GeneratePdfAccessCheck

1 string reference to 'GeneratePdfAccessCheck'
pdf_using_mpdf.services.yml in ./pdf_using_mpdf.services.yml
pdf_using_mpdf.services.yml
1 service uses GeneratePdfAccessCheck
access_check.pdf_using_mpdf.generate in ./pdf_using_mpdf.services.yml
Drupal\pdf_using_mpdf\Access\GeneratePdfAccessCheck

File

src/Access/GeneratePdfAccessCheck.php, line 16

Namespace

Drupal\pdf_using_mpdf\Access
View source
class GeneratePdfAccessCheck implements AccessInterface {

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

}

Members