/** * Logs calls and result of isPrivilegeTargetGranted() * * @Flow\After("method(Neos\Flow\Security\Authorization\PrivilegeManager->isPrivilegeTargetGranted())") * @param JoinPointInterface $joinPoint * @return void */ public function logPrivilegeAccessDecisions(JoinPointInterface $joinPoint) { $decision = $joinPoint->getResult() === true ? 'GRANTED' : 'DENIED'; $message = sprintf('Decided "%s" on privilege "%s".', $decision, $joinPoint->getMethodArgument('privilegeTargetIdentifier')); $this->securityLogger->log($message, \LOG_INFO); }
/** * Logs calls of collectGarbage() * * @Flow\AfterReturning("within(Neos\Flow\Session\SessionInterface) && method(.*->collectGarbage())") * @param JoinPointInterface $joinPoint The current joinpoint * @return void */ public function logCollectGarbage(JoinPointInterface $joinPoint) { $sessionRemovalCount = $joinPoint->getResult(); if ($sessionRemovalCount > 0) { $this->systemLogger->log(sprintf('%s: Triggered garbage collection and removed %s expired sessions.', $this->getClassName($joinPoint), $sessionRemovalCount), LOG_INFO); } elseif ($sessionRemovalCount === 0) { $this->systemLogger->log(sprintf('%s: Triggered garbage collection but no sessions needed to be removed.', $this->getClassName($joinPoint)), LOG_INFO); } elseif ($sessionRemovalCount === false) { $this->systemLogger->log(sprintf('%s: Ommitting garbage collection because another process is already running. Consider lowering the GC propability if these messages appear a lot.', $this->getClassName($joinPoint)), LOG_WARNING); } }