/**
  * Initializes the current action
  *
  * @return void
  */
 public function initializeAction()
 {
     $this->agencyRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_AgencyRepository');
     $this->referenceRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_ReferenceRepository');
     $this->localization = t3lib_div::makeInstance('Tx_Extbase_Utility_Localization');
     $this->countryRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_CountryRepository');
     $this->industryRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_IndustryRepository');
     $this->categoryRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_CategoryRepository');
     $this->revenueRepository = t3lib_div::makeInstance('Tx_Typo3Agencies_Domain_Repository_RevenueRepository');
     $this->showDeactivated = false;
     if ($GLOBALS['TSFE']->loginUser) {
         $uid = intval($GLOBALS['TSFE']->fe_user->user['uid']);
         $result = $this->agencyRepository->findByAdministrator($uid);
         if (count($result) > 0) {
             $this->administrator = $uid;
             $this->agency = $result->getFirst();
             if ($this->agency->getAdministrator() == $this->administrator) {
                 $this->showDeactivated = true;
             }
         }
     }
 }
 /**
  * @param Tx_Typo3Agencies_Domain_Model_Agency $agency
  * @return null
  */
 protected function redirectOnMissingAccessRights($agency)
 {
     if (!$agency->getAdministrator()) {
         return;
     }
     if ($agency->getAdministrator() !== intval($GLOBALS['TSFE']->fe_user->user['uid'])) {
         $this->flashMessageContainer->add('You are not allowed to edit this agency', 'Access not allowed', t3lib_message_AbstractMessage::ERROR);
         $this->redirect('enterCode');
     }
 }