‪TYPO3CMS  ‪main
RecordAccessGrantedEvent.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\EventDispatcher\StoppableEventInterface;
22 
28 final class ‪RecordAccessGrantedEvent implements StoppableEventInterface
29 {
30  private ?bool ‪$accessGranted = null;
31 
32  public function ‪__construct(
33  private readonly string $tableName,
34  private array ‪$record,
35  private readonly ‪Context $context
36  ) {}
37 
38  public function ‪isPropagationStopped(): bool
39  {
40  return $this->‪accessGranted !== null;
41  }
42 
46  public function ‪accessGranted(): bool
47  {
48  if ($this->‪accessGranted === null) {
49  throw new \RuntimeException('Access was not yet defined.', 1645506529);
50  }
51 
53  }
54 
55  public function ‪setAccessGranted(bool ‪$accessGranted): void
56  {
58  }
59 
60  public function ‪getTable(): string
61  {
62  return $this->tableName;
63  }
64 
65  public function ‪getRecord(): array
66  {
67  return ‪$this->record;
68  }
69 
70  public function ‪updateRecord(array ‪$record): void
71  {
72  $this->record = ‪$record;
73  }
74 
75  public function ‪getContext(): ‪Context
76  {
77  return $this->context;
78  }
79 }
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\setAccessGranted
‪setAccessGranted(bool $accessGranted)
Definition: RecordAccessGrantedEvent.php:55
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\getContext
‪getContext()
Definition: RecordAccessGrantedEvent.php:75
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:54
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\__construct
‪__construct(private readonly string $tableName, private array $record, private readonly Context $context)
Definition: RecordAccessGrantedEvent.php:32
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\updateRecord
‪updateRecord(array $record)
Definition: RecordAccessGrantedEvent.php:70
‪TYPO3\CMS\Webhooks\Message\$record
‪identifier readonly int readonly array $record
Definition: PageModificationMessage.php:36
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\$accessGranted
‪bool $accessGranted
Definition: RecordAccessGrantedEvent.php:30
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\getTable
‪getTable()
Definition: RecordAccessGrantedEvent.php:60
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent
Definition: RecordAccessGrantedEvent.php:29
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\getRecord
‪getRecord()
Definition: RecordAccessGrantedEvent.php:65
‪TYPO3\CMS\Core\Domain\Access
Definition: RecordAccessGrantedEvent.php:18
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\isPropagationStopped
‪isPropagationStopped()
Definition: RecordAccessGrantedEvent.php:38
‪TYPO3\CMS\Core\Domain\Access\RecordAccessGrantedEvent\accessGranted
‪accessGranted()
Definition: RecordAccessGrantedEvent.php:46