/** * @param int $state State to log * @param User $user Related User * @param array $additionalProperties for individual logging * @return void */ public static function log($state, User $user, array $additionalProperties = []) { if (!ConfigurationUtility::isDisableLogActive()) { $log = self::getLog(); $log->setTitle(LocalizationUtility::translateByState($state)); $log->setState($state); $log->setUser($user); self::getLogRepository()->add($log); } self::getDispatcher()->dispatch(__CLASS__, __FUNCTION__ . 'Custom', [$state, $user, $additionalProperties]); }
/** * Check if user is allowed to see this action * * @return bool */ protected function allowedUserForInvitationNewAndCreate() { if (empty($this->settings['invitation']['allowedUserGroups'])) { return true; } $allowedUsergroupUids = GeneralUtility::trimExplode(',', $this->settings['invitation']['allowedUserGroups'], true); $currentUsergroupUids = UserUtility::getCurrentUsergroupUids(); // compare allowedUsergroups with currentUsergroups if (count(array_intersect($allowedUsergroupUids, $currentUsergroupUids))) { return true; } // current user is not allowed $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_INVITATIONRESTRICTEDPAGE), '', FlashMessage::ERROR); $this->forward('status'); return false; }
/** * Check if user is authenticated * * @param User $user * @param int $uid Given fe_users uid * @return void */ protected function testSpoof($user, $uid) { if ($user->getUid() !== (int) $uid && $uid > 0) { LogUtility::log(Log::STATUS_PROFILEUPDATEREFUSEDSECURITY, $user); $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_PROFILEUPDATEREFUSEDSECURITY), '', FlashMessage::ERROR); $this->forward('edit'); } }
/** * action delete * * @param User $user * @return void */ public function deleteAction(User $user) { LogUtility::log(Log::STATUS_PROFILEDELETE, $user); $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_PROFILEDELETE)); $this->userRepository->remove($user); $this->redirectByAction('delete'); $this->redirect('edit'); }