public function EditionsController::checkAccess in Simplenews Scheduler 2.0.x
Same name and namespace in other branches
- 8 src/Controller/EditionsController.php \Drupal\simplenews_scheduler\Controller\EditionsController::checkAccess()
Check whether to display the Scheduled Newsletter tab.
1 string reference to 'EditionsController::checkAccess'
File
- src/
Controller/ EditionsController.php, line 72 - Contains \Drupal\simplenews_scheduler\Controller\EditionsController.
Class
- EditionsController
- Default controller for the simplenews_scheduler module.
Namespace
Drupal\simplenews_scheduler\ControllerCode
public function checkAccess(NodeInterface $node) {
// Check if this is a simplenews node type and permission.
if ($node
->hasField('simplenews_issue') && $node->simplenews_issue->target_id != NULL && $this->currentUser
->hasPermission('overview scheduled newsletters')) {
// Check if this is either a scheduler newsletter or an edition.
return AccessResult::allowedIf(!empty($node->simplenews_scheduler) || !empty($node->is_edition));
}
return AccessResult::forbidden();
}