diff --git a/Classes/Domain/Model/Visitor.php b/Classes/Domain/Model/Visitor.php index e578d130..d69a4e08 100644 --- a/Classes/Domain/Model/Visitor.php +++ b/Classes/Domain/Model/Visitor.php @@ -18,6 +18,7 @@ use In2code\Lux\Exception\ConfigurationException; use In2code\Lux\Utility\BackendUtility; use In2code\Lux\Utility\DatabaseUtility; +use In2code\Lux\Utility\EnvironmentUtility; use In2code\Lux\Utility\LocalizationUtility; use In2code\Lux\Utility\ObjectUtility; use In2code\Lux\Utility\StringUtility; @@ -471,7 +472,11 @@ public function getPagevisitsAuthorized(): array */ public function getPagevisits(): array { - $pagevisits = $this->getPagevisitsAuthorized(); + if (EnvironmentUtility::isBackend()) { + $pagevisits = $this->getPagevisitsAuthorized(); + } else { + $pagevisits = $this->pagevisits; + } $pagevisitsArray = []; /** @var Pagevisit $pagevisit */ foreach ($pagevisits as $pagevisit) { diff --git a/Classes/Utility/EnvironmentUtility.php b/Classes/Utility/EnvironmentUtility.php new file mode 100644 index 00000000..558cf1ca --- /dev/null +++ b/Classes/Utility/EnvironmentUtility.php @@ -0,0 +1,27 @@ +isFrontend(); + } + + /** + * @return bool + * @SuppressWarnings(PHPMD.Superglobals) + */ + public static function isBackend(): bool + { + return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); + } +} diff --git a/Classes/Utility/FrontendUtility.php b/Classes/Utility/FrontendUtility.php index 708aa336..8644c230 100644 --- a/Classes/Utility/FrontendUtility.php +++ b/Classes/Utility/FrontendUtility.php @@ -56,15 +56,6 @@ public static function getPropertyFromLoggedInFrontendUser($propertyName = 'uid' return ''; } - /** - * @return bool - * @SuppressWarnings(PHPMD.Superglobals) - */ - public static function isFrontendMode(): bool - { - return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend(); - } - /** * @return ?TypoScriptFrontendController * @SuppressWarnings(PHPMD.Superglobals)