‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Domain\Access\RecordAccessVoter Class Reference

Public Member Functions

 __construct (protected readonly EventDispatcherInterface $eventDispatcher)
 
bool accessGranted (string $table, array $record, Context $context)
 
bool groupAccessGranted (string $table, array $record, Context $context)
 
 accessGrantedForPageInRootLine (array $pageRecord, Context $context)
 

Protected Member Functions

 getEnableFieldsConfigurationForTable (string $table)
 

Detailed Description

Checks if a record can be accessed (usually in TYPO3 Frontend) due to various "enableFields" or group access checks.

Not related to "write permissions" etc.

Definition at line 28 of file RecordAccessVoter.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Domain\Access\RecordAccessVoter::__construct ( protected readonly EventDispatcherInterface  $eventDispatcher)

Definition at line 30 of file RecordAccessVoter.php.

Member Function Documentation

◆ accessGranted()

bool TYPO3\CMS\Core\Domain\Access\RecordAccessVoter::accessGranted ( string  $table,
array  $record,
Context  $context 
)

Checks page record for enableFields Returns TRUE if enableFields does not disable the page record. Takes notice of the includeHiddenPages visibility aspect flag and uses SIM_ACCESS_TIME for start/endtime evaluation

Parameters
string$table‪the TCA table to check for
array$record‪The record to evaluate (needs fields: hidden, starttime, endtime, fe_group)
Context$contextContext API to check against
Returns
‪bool TRUE, if record is viewable.

Definition at line 44 of file RecordAccessVoter.php.

References $GLOBALS, TYPO3\CMS\Webhooks\Message\$record, TYPO3\CMS\Core\Context\Context\getAspect(), TYPO3\CMS\Core\Domain\Access\RecordAccessVoter\getEnableFieldsConfigurationForTable(), and TYPO3\CMS\Core\Domain\Access\RecordAccessVoter\groupAccessGranted().

Referenced by TYPO3\CMS\Core\Domain\Access\RecordAccessVoter\accessGrantedForPageInRootLine().

◆ accessGrantedForPageInRootLine()

TYPO3\CMS\Core\Domain\Access\RecordAccessVoter::accessGrantedForPageInRootLine ( array  $pageRecord,
Context  $context 
)

Checks if the current page of the root line is visible.

If the field extendToSubpages is 0, access is granted, else the fields hidden, starttime, endtime, fe_group are evaluated.

this is a special use case and should only be used with care, not part of TYPO3's Public API.

Definition at line 114 of file RecordAccessVoter.php.

References TYPO3\CMS\Core\Domain\Access\RecordAccessVoter\accessGranted().

◆ getEnableFieldsConfigurationForTable()

TYPO3\CMS\Core\Domain\Access\RecordAccessVoter::getEnableFieldsConfigurationForTable ( string  $table)
protected

◆ groupAccessGranted()

bool TYPO3\CMS\Core\Domain\Access\RecordAccessVoter::groupAccessGranted ( string  $table,
array  $record,
Context  $context 
)

Check group access against a record, if the current users' groups match the fe_group values of the record.

Parameters
string$table‪the TCA table to check for
array$record‪The record to evaluate (needs enableField: fe_group)
Context$contextContext API to check against
Returns
‪bool TRUE, if group access is granted.

Definition at line 92 of file RecordAccessVoter.php.

References TYPO3\CMS\Webhooks\Message\$record, TYPO3\CMS\Core\Context\Context\getAspect(), TYPO3\CMS\Core\Domain\Access\RecordAccessVoter\getEnableFieldsConfigurationForTable(), and TYPO3\CMS\Core\Context\Context\hasAspect().

Referenced by TYPO3\CMS\Core\Domain\Access\RecordAccessVoter\accessGranted().