$userObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj();
$pageUid = 123; // The UID of the page we want to check access for $userObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj(); $hasAccess = $userObj->checkPageAccess($pageUid); if ($hasAccess) { // User has access to the page } else { // User does not have access to the page }In this example, we are using the checkPageAccess() method of the user object to check whether the current user has access to a specific page with the UID 123. If the user has access, we display a message indicating that they have access. If the user does not have access, we display a message indicating that they do not have access. Package library: TYPO3\CMS\Core