/**
  * 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']);
 }
Example #2
0
 /**
  * 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']);
 }
 /**
  * action update
  * @param \MUM\BjrFreizeit\Domain\Model\Organization $organization
  * @return void
  *
  * @ignorevalidate   \MUM\BjrFreizeit\Validation\Validator\Organization
  */
 public function updateAction(\MUM\BjrFreizeit\Domain\Model\Organization $organization)
 {
     $redirectParams = array();
     //array('passwordChange' => '',    'organization' => $organization,'organizationChange' => ''       );
     $args = $this->request->getArguments();
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($args);
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($organization);
     if (array_key_exists('organizationUpdate', $args)) {
         if (strlen($args['password']) > 0) {
             $passwordChange = $this->doPasswordChange(array($this->request->getArgument('password'), $this->request->getArgument('passwordConfirmation')), $this->request->getArgument('feuserId'));
             if ($passwordChange == 1) {
                 $this->setFlashMessage('Das Passwort wurde geändert.');
                 //$redirectParams['passwordChange'] = 'Das Passwort wurde geändert.';
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "passwordChange", 'Das Passwort wurde geändert.');
             }
             if ($passwordChange == -1) {
                 $this->setFlashMessage('Das Passwort stimmt nicht mit der Kontrolleingabe überein.', 'FEHLER', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                 $this->forward('edit');
             }
         }
         //select Field value is not set in organization, do it manually
         if ($this->isAdministratorMode()) {
             $organization->setLeisureFolderPid($this->request->getArgument('leisureFolderPid'));
         }
         if ($this->request->hasArgument('creation') && $this->request->getArgument('creation') == 1) {
             $organization->setPid($this->settings['pidOrganizationFolder']);
             $organization->setFeusername($this->frontendUserRepository->findByUid($this->request->getArgument('username')));
             //email Adresse ist pflicht
             if ($this->validateOrganization($args)) {
                 $this->organizationRepository->add($organization);
                 //it is not persistent already, we have to do it!
                 $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
                 $persistenceManager->persistAll();
                 //now organization ist persistent
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "organizationChange", 'Die Ausleihstelle wurde neu angelegt.');
             } else {
                 $errors = $this->getValidationErrors();
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "editErrors", implode('.<br />', $errors));
                 //DebuggerUtility::var_dump($organization);
                 //exit();
                 //$redirectParams['organization'] = $organization;
                 $redirectParams['attributes'] = $args;
                 $this->redirect('new', 'Organization', NULL, $redirectParams);
             }
         } else {
             if ($this->validateOrganization($args)) {
                 $this->organizationRepository->update($organization);
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "organizationChange", 'Die Ausleihstelle wurde geändert.');
             } else {
                 $errors = $this->getValidationErrors();
                 $GLOBALS['TSFE']->fe_user->setKey("ses", "editErrors", implode('. ', $errors));
                 $redirectParams['organization'] = $organization;
                 $this->redirect('edit', 'Organization', NULL, $redirectParams);
             }
         }
     }
     $redirectParams['organization'] = $organization;
     $this->redirect('successUpdate', 'Organization', NULL, $redirectParams);
 }
 /**
  * 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;
     }
 }
Example #7
0
 /**
  * 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;
 }
Example #8
0
 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);
 }
 /**
  * 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);
 }