public function ViewPrintController::checkAccess in Entity Print 8.2
Validate that the current user has access.
We need to validate that the user is allowed to access this entity also the print version.
@TODO, improve permissions in https://www.drupal.org/node/2759553
Parameters
string $export_type: The export type.
string $view_name: The view name.
string $display_id: The view display to render.
Return value
\Drupal\Core\Access\AccessResult The access result object.
1 string reference to 'ViewPrintController::checkAccess'
- entity_print_views.routing.yml in modules/
entity_print_views/ entity_print_views.routing.yml - modules/entity_print_views/entity_print_views.routing.yml
File
- modules/
entity_print_views/ src/ Controller/ ViewPrintController.php, line 167
Class
- ViewPrintController
- Controller class for printing Views.
Namespace
Drupal\entity_print_views\ControllerCode
public function checkAccess($export_type, $view_name, $display_id) {
$view = $this->entityTypeManager
->getStorage('view')
->load($view_name)
->getExecutable();
$account = $this
->currentUser();
// Check the Entity Print Views permission.
$result = AccessResult::allowedIfHasPermission($account, 'entity print views access');
// Also check the permissions defined by the view.
return $result
->isAllowed() && $view
->access($display_id, $account) ? $result : AccessResult::forbidden();
}