public function FillPdfAccessController::checkLink in FillPDF 5.0.x
Same name and namespace in other branches
- 8.4 src/FillPdfAccessController.php \Drupal\fillpdf\FillPdfAccessController::checkLink()
Checks whether the current user has access to the current request.
Return value
\Drupal\Core\Access\AccessResultInterface Access result value object.
1 string reference to 'FillPdfAccessController::checkLink'
File
- src/
FillPdfAccessController.php, line 103
Class
- FillPdfAccessController
- Defines a custom access controller for the FillPDF generation route.
Namespace
Drupal\fillpdfCode
public function checkLink() {
try {
$context = $this->linkManipulator
->parseRequest($this->requestStack
->getCurrentRequest());
} catch (\InvalidArgumentException $exception) {
$message = $exception
->getMessage();
$is_admin = $this->currentUser
->hasPermission('administer pdfs');
$this
->messenger()
->addError($is_admin ? $message : t('An error occurred. Please notify the administrator.'));
$this
->getLogger('fillpdf')
->error($message);
return AccessResult::forbidden();
}
$account = $this->currentUser;
return $this->accessHelper
->canGeneratePdfFromContext($context, $account);
}