コード例 #1
0
 /**
  * Status action.
  *
  * @param \Causal\IgLdapSsoAuth\Domain\Model\Configuration $configuration
  * @return void
  */
 public function statusAction(\Causal\IgLdapSsoAuth\Domain\Model\Configuration $configuration = NULL)
 {
     // If configuration has been deleted
     if ($configuration === NULL) {
         $this->redirect('index');
     }
     $this->saveState($configuration);
     Configuration::initialize(TYPO3_MODE, $configuration);
     $this->populateView($configuration);
     $ldapConfiguration = Configuration::getLdapConfiguration();
     $connectionStatus = array();
     if ($ldapConfiguration['host'] !== '') {
         $ldapConfiguration['server'] = Configuration::getServerType($ldapConfiguration['server']);
         try {
             $this->ldap->connect($ldapConfiguration);
         } catch (\Exception $e) {
             // Possible known exception: 1409566275, LDAP extension is not available for PHP
             $this->addFlashMessage($e->getMessage(), 'Error ' . $e->getCode(), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
         }
         $ldapConfiguration['protocol'] = $this->translate('module_status.messages.formatProtocol', array($ldapConfiguration['protocol']));
         // Never ever show the password as plain text
         $ldapConfiguration['password'] = $ldapConfiguration['password'] ? '••••••••••••' : NULL;
         $connectionStatus = $this->ldap->getStatus();
     } else {
         $ldapConfiguration = $this->translate('module_status.messages.ldapDisable');
     }
     $frontendConfiguration = Configuration::getFrontendConfiguration();
     if ($frontendConfiguration['LDAPAuthentication'] === FALSE) {
         // Remove every other info since authentication is disabled for this mode
         $frontendConfiguration = array('LDAPAuthentication' => FALSE);
     }
     $backendConfiguration = Configuration::getBackendConfiguration();
     if ($backendConfiguration['LDAPAuthentication'] === FALSE) {
         // Remove every other info since authentication is disabled for this mode
         $backendConfiguration = array('LDAPAuthentication' => FALSE);
     }
     $this->view->assign('configuration', array('domains' => Configuration::getDomains(), 'ldap' => $ldapConfiguration, 'connection' => $connectionStatus, 'frontend' => $frontendConfiguration, 'backend' => $backendConfiguration));
 }