
| Current Path : /var/www/html/12park/web/modules/contrib/webform/src/Access/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/12park/web/modules/contrib/webform/src/Access/WebformSourceEntityAccess.php |
<?php
namespace Drupal\webform\Access;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Defines the custom access control handler for the webform source entities.
*/
class WebformSourceEntityAccess {
/**
* Check whether the user can access an entity's webform results.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* An entity.
* @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public static function checkEntityResultsAccess(EntityInterface $entity, AccountInterface $account) {
/** @var \Drupal\webform\WebformEntityReferenceManagerInterface $entity_reference_manager */
$entity_reference_manager = \Drupal::service('webform.entity_reference_manager');
$access = $entity->access('update', $account, TRUE);
$access->andIf(AccessResult::allowedIf($entity_reference_manager->getWebform($entity)));
return $access;
}
}