/** * Initializes the configuration class. * * @param string $mode TYPO3 mode, either 'be' or 'fe' * @param \Causal\IgLdapSsoAuth\Domain\Model\Configuration $configuration */ public static function initialize($mode, \Causal\IgLdapSsoAuth\Domain\Model\Configuration $configuration) { $globalConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ig_ldap_sso_auth']); if (!is_array($globalConfiguration)) { $globalConfiguration = array(); } // Legacy configuration options unset($globalConfiguration['evaluateGroupsFromMembership']); static::$configuration = $configuration; // Default TYPO3_MODE is BE static::setMode($mode ?: TYPO3_MODE); // Select configuration from database, merge with extension configuration template and initialise class attributes. static::$domains = array(); $domainUids = GeneralUtility::intExplode(',', $configuration->getDomains(), TRUE); foreach ($domainUids as $domainUid) { $row = static::getDatabaseConnection()->exec_SELECTgetSingleRow('domainName', 'sys_domain', 'uid=' . intval($domainUid)); static::$domains[] = $row['domainName']; } static::$be['LDAPAuthentication'] = (bool) $globalConfiguration['enableBELDAPAuthentication']; static::$be['SSOAuthentication'] = FALSE; static::$be['forceLowerCaseUsername'] = $globalConfiguration['forceLowerCaseUsername'] ? (bool) $globalConfiguration['forceLowerCaseUsername'] : FALSE; static::$be['evaluateGroupsFromMembership'] = $configuration->getGroupMembership() === static::GROUP_MEMBERSHIP_FROM_MEMBER; static::$be['IfUserExist'] = (bool) $globalConfiguration['TYPO3BEUserExist']; static::$be['IfGroupExist'] = (bool) $globalConfiguration['TYPO3BEGroupExist']; static::$be['BEfailsafe'] = (bool) $globalConfiguration['BEfailsafe']; static::$be['DeleteUserIfNoLDAPGroups'] = FALSE; static::$be['DeleteUserIfNoTYPO3Groups'] = FALSE; static::$be['GroupsNotSynchronize'] = (bool) $globalConfiguration['TYPO3BEGroupsNotSynchronize']; static::$be['requiredLDAPGroups'] = $configuration->getBackendGroupsRequired() ? $configuration->getBackendGroupsRequired() : array(); static::$be['updateAdminAttribForGroups'] = $configuration->getBackendGroupsAdministrator() ? $configuration->getBackendGroupsAdministrator() : array(); static::$be['assignGroups'] = $configuration->getBackendGroupsAssigned() ? $configuration->getBackendGroupsAssigned() : array(); static::$be['keepTYPO3Groups'] = (bool) $globalConfiguration['keepBEGroups']; static::$be['users']['basedn'] = $configuration->getBackendUsersBaseDn(); static::$be['users']['filter'] = $configuration->getBackendUsersFilter(); static::$be['users']['mapping'] = static::makeUserMapping($configuration->getBackendUsersMapping(), $configuration->getBackendUsersFilter()); static::$be['groups']['basedn'] = $configuration->getBackendGroupsBaseDn(); static::$be['groups']['filter'] = $configuration->getBackendGroupsFilter(); static::$be['groups']['mapping'] = static::makeGroupMapping($configuration->getBackendGroupsMapping()); static::$fe['LDAPAuthentication'] = (bool) $globalConfiguration['enableFELDAPAuthentication']; static::$fe['SSOAuthentication'] = (bool) $globalConfiguration['enableFESSO']; static::$fe['forceLowerCaseUsername'] = $globalConfiguration['forceLowerCaseUsername'] ? (bool) $globalConfiguration['forceLowerCaseUsername'] : FALSE; static::$fe['evaluateGroupsFromMembership'] = $configuration->getGroupMembership() === static::GROUP_MEMBERSHIP_FROM_MEMBER; static::$fe['IfUserExist'] = (bool) $globalConfiguration['TYPO3FEUserExist']; static::$fe['IfGroupExist'] = (bool) $globalConfiguration['TYPO3FEGroupExist']; static::$fe['BEfailsafe'] = FALSE; static::$fe['updateAdminAttribForGroups'] = array(); static::$fe['DeleteUserIfNoTYPO3Groups'] = (bool) $globalConfiguration['TYPO3FEDeleteUserIfNoTYPO3Groups']; static::$fe['DeleteUserIfNoLDAPGroups'] = (bool) $globalConfiguration['TYPO3FEDeleteUserIfNoLDAPGroups']; static::$fe['GroupsNotSynchronize'] = (bool) $globalConfiguration['TYPO3FEGroupsNotSynchronize']; static::$fe['assignGroups'] = $configuration->getFrontendGroupsAssigned() ? $configuration->getFrontendGroupsAssigned() : array(); static::$fe['keepTYPO3Groups'] = (bool) $globalConfiguration['keepFEGroups']; static::$fe['requiredLDAPGroups'] = $configuration->getFrontendGroupsRequired() ? $configuration->getFrontendGroupsRequired() : array(); static::$fe['users']['basedn'] = $configuration->getFrontendUsersBaseDn(); static::$fe['users']['filter'] = $configuration->getFrontendUsersFilter(); static::$fe['users']['mapping'] = static::makeUserMapping($configuration->getFrontendUsersMapping(), $configuration->getFrontendUsersFilter()); static::$fe['groups']['basedn'] = $configuration->getFrontendGroupsBaseDn(); static::$fe['groups']['filter'] = $configuration->getFrontendGroupsFilter(); static::$fe['groups']['mapping'] = static::makeGroupMapping($configuration->getFrontendGroupsMapping()); static::$ldap['server'] = $configuration->getLdapServer(); static::$ldap['charset'] = $configuration->getLdapCharset() ? $configuration->getLdapCharset() : 'utf-8'; static::$ldap['protocol'] = $configuration->getLdapProtocol(); static::$ldap['host'] = $configuration->getLdapHost(); static::$ldap['port'] = $configuration->getLdapPort(); static::$ldap['tls'] = $configuration->isLdapTls(); static::$ldap['binddn'] = $configuration->getLdapBindDn(); static::$ldap['password'] = $configuration->getLdapPassword(); }