Skip to content
Snippets Groups Projects
Commit 57e1dd4e authored by Kevin Kaland's avatar Kevin Kaland
Browse files

Issue #2359213: Stub out actually checking access.

parent 45f62b27
No related branches found
No related tags found
No related merge requests found
<?php <?php
/** /**
* @file * @file
* Contains \Drupal\fillpdf\FillPdfAccessController. * Contains \Drupal\fillpdf\FillPdfAccessController.
*/ */
namespace Drupal\fillpdf; namespace Drupal\fillpdf;
use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResult;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
class FillPdfAccessController { class FillPdfAccessController implements ContainerInjectionInterface {
/** @var FillPdfLinkManipulatorInterface $linkManipulator */
protected $linkManipulator;
/** @var RequestStack $requestStack */
protected $requestStack;
/** @var FillPdfContextManagerInterface $contextManager */
protected $contextManager;
public function __construct(FillPdfLinkManipulatorInterface $link_manipulator, FillPdfContextManagerInterface $context_manager, RequestStack $request_stack) {
$this->linkManipulator = $link_manipulator;
$this->contextManager = $context_manager;
$this->requestStack = $request_stack;
}
/**
* {@inheritDoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('fillpdf.link_manipulator'), $container->get('fillpdf.context_manager'), $container->get('request_stack'));
}
public function checkLink() {
$context = $this->linkManipulator->parseLink($this->requestStack->getCurrentRequest());
// TODO: samples can be viewed by admins
if ($context['sample']) {
// ...
}
$entities = $this->contextManager->loadEntities($context);
foreach ($entities as $entity_type => $entity_objects) {
// If there are any entities in the context that the user can't view,
// deny access.
// TODO: return AccessResult:forbiddenIf accordingly
}
function checkLink() {
// TODO: Actually do access checking here
return AccessResult::allowedIf(TRUE); return AccessResult::allowedIf(TRUE);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment