/** * Finds out the actual logged in user * @param \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository $repo * @return \SLUB\Vk2\Domain\Model\User $user */ public static function getActualUser($repo) { $user = $GLOBALS['TSFE']->fe_user->user; if (!$user) { return null; } $feUserObj = $repo->findByUid($user['uid']); return $feUserObj; }
/** * Gets the currently logged in Frontend User * * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser * @api */ public function getCurrentFrontendUser() { if (FALSE === $GLOBALS['TSFE']->loginUser) { return NULL; } return $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); }
/** * Cast a user that might be a child class to a base FE user. * * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $user * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser */ private function castUser(FrontendUser $user) { if (get_class($user) !== 'TYPO3\\CMS\\Extbase\\Domain\\Model\\FrontendUser') { $user = $this->userRepo->findByUid($user->getUid()); } return $user; }
/** * Gets the currently logged in Frontend User * * @return FrontendUser|NULL * @api */ public function getCurrentFrontendUser() { if (true === empty($GLOBALS['TSFE']->loginUser)) { return null; } return $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); }
/** * Get current logged-in user * * @return null|FrontendUser */ public function getFeUser() { static $frontEndUser; if ($frontEndUser === NULL && isset($GLOBALS['TSFE']) && $GLOBALS['TSFE']->loginUser && $GLOBALS['TSFE']->fe_user->user['uid']) { $frontEndUser = $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); } return $frontEndUser; }
/** * Returns the current frontend user object if available * * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser|null */ public function getCurrentFeUserObject() { if (isset($GLOBALS['TSFE']->fe_user->user['uid'])) { return $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); } else { return null; } }
/** * @return mixed */ protected function getFeUserList() { //$feUserRepository = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository'); $querySettings = $this->frontendUserRepository->createQuery()->getQuerySettings(); $querySettings->setStoragePageIds(array($this->settings['pidFrontendUser'])); $this->frontendUserRepository->setDefaultQuerySettings($querySettings); $feUserList = $this->frontendUserRepository->findByUsergroup($this->settings['frontendUserGroup']); return $feUserList; }
protected function assignAuthorSelectOptions() { $authors = array(); $users = explode(',', $this->settings['blog']['users'] ?: '0'); foreach ($users as $key => $uid) { $autors[] = $this->frontendUserRepository->findByUid($uid); } $this->view->assign('authors', $autors); }
/** * Creates unique username * * @return string */ protected function createUniqueUserName() { $hash = md5(time()); $username = $this->frontendUserRepository->findByUsername($hash)->getFirst(); if ($username !== null) { $this->createUniqueUserName(); } return $hash; }
public function createAction(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser) { //TODO prüfen ob username doppelt vergeben wird. if ($feUser->getPassword() == $this->request->getArgument('passwordConfirmation')) { $feUser->setPid($this->settings['pidFrontendUser']); $feUser->_setProperty('tx_extbase_type', 'Tx_Extbase_Domain_Model_FrontendUser'); $feUser->addUserGroup($this->frontendUserGroupRepository->findByUid($this->settings['frontendUserGroup'])); $this->frontendUserRepository->add($feUser); //it is not persistent already, we have to do it! $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); $persistenceManager->persistAll(); //now feuser ist persistent // Message for User $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserCreate", 'Der User <b>' . $feUser->getUsername() . '</b> wurde neu angelegt.'); $redirectParams['feUser'] = $feUser; $this->redirect('successUpdate', 'FrontendUser', NULL, $redirectParams); } else { $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserCreate", 'Das Passwort stimmt nicht überein.'); $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserData", array('username' => $feUser->getUsername())); $redirectParams['feUser'] = $feUser; $this->redirect('new', 'FrontendUser', NULL, array()); } }
/** * Finds an object matching the given identifier. * * @param mixed $identifier The identifier of the object to find * @param bool $ignoreHidden Whether to ignore hidden state * * @return NULL|\Evoweb\SfRegister\Interfaces\FrontendUserInterface */ public function findByIdentifier($identifier, $ignoreHidden = false) { if ($ignoreHidden) { return parent::findByIdentifier($identifier); } $query = $this->createQuery(); $querySettings = $query->getQuerySettings(); $querySettings->setRespectStoragePage(false); $querySettings->setRespectSysLanguage(false); $querySettings->setIgnoreEnableFields(true); $querySettings->setEnableFieldsToBeIgnored(array('disabled')); $object = $query->matching($query->equals('uid', $identifier))->execute()->getFirst(); return $object; }
/** * Gets the current logged in user, if available. * * @return \CIC\Cicregister\Domain\Model\FrontendUser */ public function getCurrentUser() { if (!$this->currentUser) { if (isset($GLOBALS['TSFE']) && isset($GLOBALS['TSFE']->fe_user)) { $uid = $GLOBALS['TSFE']->fe_user->user['uid']; if ($uid) { // For some reason, this is not injected every time if (!$this->frontendUserRepository) { $this->frontendUserRepository = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository'); } $query = $this->frontendUserRepository->createQuery(); $qSettings = $query->getQuerySettings(); $qSettings->setRespectStoragePage(FALSE); $query->setQuerySettings($qSettings); $result = $query->matching($query->equals('uid', $uid))->execute(); $this->currentUser = $result->getFirst(); } } } return $this->currentUser; }
/** * gets current logged in frontenduser * * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser */ public function getActualUser() { $user = $GLOBALS['TSFE']->fe_user->user; $feUserObj = $this->feUserRepository->findByUid($user['uid']); return $feUserObj; }
protected function initFeUser() { $userUid = $GLOBALS['TSFE']->fe_user->user['uid']; $this->feUser = $this->feUserRepository->findByUid($userUid); }