Commit 29792683 authored by nicola85's avatar nicola85

Check if node is not null on BeeAvailabilityAccessCheck

parent a54ce46b
......@@ -18,7 +18,7 @@ class BeeAddReservationAccessCheck implements AccessInterface {
protected $entityTypeManager;
/**
* Constructs a BeeAvailabilityAccessCheck object.
* Constructs a BeeAddReservationAccessCheck object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager
* The entity manager.
......
......@@ -35,11 +35,13 @@ class BeeAvailabilityAccessCheck implements AccessInterface {
* A \Drupal\Core\Access\AccessInterface constant value.
*/
public function access(AccountInterface $account, Node $node = NULL) {
$bee_settings = \Drupal::config('node.type.' . $node->bundle())->get('bee');
if ($node) {
$bee_settings = \Drupal::config('node.type.' . $node->bundle())->get('bee');
if (isset($bee_settings['bookable']) && $bee_settings['bookable']) {
if ($account->hasPermission('admin ' . $node->bundle() . ' bee availability')) {
return AccessResult::allowed();
if (isset($bee_settings['bookable']) && $bee_settings['bookable']) {
if ($account->hasPermission('admin ' . $node->bundle() . ' bee availability')) {
return AccessResult::allowed();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment