private function connect() { if (!$this->connected) { $helper = new \OCA\User_LDAP\Helper(); $configPrefixes = $helper->getServerConfigurationPrefixes(true); $this->ldap = new \OCA\User_LDAP\LDAP(); $dbc = \OC::$server->getDatabaseConnection(); $this->usermanager = new \OCA\User_LDAP\User\Manager(\OC::$server->getConfig(), new \OCA\User_LDAP\FilesystemHelper(), new \OCA\User_LDAP\LogWrapper(), \OC::$server->getAvatarManager(), new \OCP\Image(), $dbc, \OC::$server->getUserManager()); $this->connection = new \OCA\User_LDAP\Connection($this->ldap, $configPrefixes[0]); $this->access = new \OCA\User_LDAP\Access($this->connection, $this->ldap, $this->usermanager); $this->access->setUserMapper(new \OCA\User_LDAP\Mapping\UserMapping($dbc)); $this->access->setGroupMapper(new \OCA\User_LDAP\Mapping\GroupMapping($dbc)); $this->connected = true; } }
* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ OC_Util::checkAdminUser(); // fill template $tmpl = new OCP\Template('user_ldap', 'settings'); $helper = new \OCA\User_LDAP\Helper(); $prefixes = $helper->getServerConfigurationPrefixes(); $hosts = $helper->getServerConfigurationHosts(); $wizardHtml = ''; $toc = array(); $wControls = new OCP\Template('user_ldap', 'part.wizardcontrols'); $wControls = $wControls->fetchPage(); $sControls = new OCP\Template('user_ldap', 'part.settingcontrols'); $sControls = $sControls->fetchPage(); $l = \OC::$server->getL10N('user_ldap'); $wizTabs = array(); $wizTabs[] = array('tpl' => 'part.wizard-server', 'cap' => $l->t('Server')); $wizTabs[] = array('tpl' => 'part.wizard-userfilter', 'cap' => $l->t('Users')); $wizTabs[] = array('tpl' => 'part.wizard-loginfilter', 'cap' => $l->t('Login Attributes')); $wizTabs[] = array('tpl' => 'part.wizard-groupfilter', 'cap' => $l->t('Groups')); $wizTabsCount = count($wizTabs); for ($i = 0; $i < $wizTabsCount; $i++) {
* This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ OCP\App::registerAdmin('user_ldap', 'settings'); $helper = new \OCA\User_LDAP\Helper(); $configPrefixes = $helper->getServerConfigurationPrefixes(true); $ldapWrapper = new OCA\User_LDAP\LDAP(); $ocConfig = \OC::$server->getConfig(); if (count($configPrefixes) === 1) { $dbc = \OC::$server->getDatabaseConnection(); $userManager = new OCA\User_LDAP\User\Manager($ocConfig, new OCA\User_LDAP\FilesystemHelper(), new OCA\User_LDAP\LogWrapper(), \OC::$server->getAvatarManager(), new \OCP\Image(), $dbc, \OC::$server->getUserManager()); $connector = new OCA\User_LDAP\Connection($ldapWrapper, $configPrefixes[0]); $ldapAccess = new OCA\User_LDAP\Access($connector, $ldapWrapper, $userManager, $helper); $ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc)); $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc)); $userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig); $groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess); } else { if (count($configPrefixes) > 1) { $userBackend = new OCA\User_LDAP\User_Proxy($configPrefixes, $ldapWrapper, $ocConfig); $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper);
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $helper = new \OCA\User_LDAP\Helper(); $serverConnections = $helper->getServerConfigurationPrefixes(); sort($serverConnections); $lk = array_pop($serverConnections); $ln = intval(str_replace('s', '', $lk)); $nk = 's' . str_pad($ln + 1, 2, '0', STR_PAD_LEFT); $resultData = array('configPrefix' => $nk); $newConfig = new \OCA\User_LDAP\Configuration($nk, false); if (isset($_POST['copyConfig'])) { $originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']); $newConfig->setConfiguration($originalConfig->getConfiguration()); } else { $configuration = new \OCA\User_LDAP\Configuration($nk, false); $newConfig->setConfiguration($configuration->getDefaults()); $resultData['defaults'] = $configuration->getDefaults(); } $newConfig->saveConfiguration();