if (!is_null($pw)) { $pwEnc = base64_encode($pw); OCP\Config::setAppValue('user_ldap', 'ldap_agent_password', $pwEnc); OC_Appconfig::deleteKey('user_ldap', 'ldap_password'); } //detect if we can switch on naming guidelines. We won't do it on conflicts. //it's a bit spaghetti, but hey. $state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset'); if ($state == 'unset') { OCP\Config::setSystemValue('ldapIgnoreNamingRules', false); } // ### SUPPORTED upgrade path starts here ### //from version 0.2 to 0.3 (0.2.0.x dev version) $objects = array('user', 'group'); $connector = new \OCA\user_ldap\lib\Connection('user_ldap'); $userBE = new \OCA\user_ldap\USER_LDAP(); $userBE->setConnector($connector); $groupBE = new \OCA\user_ldap\GROUP_LDAP(); $groupBE->setConnector($connector); foreach ($objects as $object) { $fetchDNSql = 'SELECT `ldap_dn`, `owncloud_name` FROM `*PREFIX*ldap_' . $object . '_mapping` WHERE `directory_uuid` = ""'; $updateSql = 'UPDATE `*PREFIX*ldap_' . $object . '_mapping` SET `ldap_DN` = ?, `directory_uuid` = ? WHERE `ldap_dn` = ?'; $query = OCP\DB::prepare($fetchDNSql); $res = $query->execute(); $DNs = $res->fetchAll(); $updateQuery = OCP\DB::prepare($updateSql); foreach ($DNs as $dn) { $newDN = mb_strtolower($dn['ldap_dn'], 'UTF-8'); if ($object == 'user') { $uuid = $userBE->getUUID($newDN); //fix home folder to avoid new ones depending on the configuration
public static function registerBackends($usedBackends) { //OC_Log::write('OC_USER_OTP', __FUNCTION__.'().', OC_Log::DEBUG); if (self::$_backends === null) { foreach ($usedBackends as $backend) { OC_Log::write('user_otp', 'instance ' . $backend . ' backend.', OC_Log::DEBUG); self::$_backends[$backend] = new $backend(); if (self::$_backends[$backend] instanceof OCA\user_ldap\USER_LDAP || self::$_backends[$backend] instanceof OCA\user_ldap\User_Proxy) { OC_Log::write('OC_USER_OTP az', __FUNCTION__ . '().', OC_Log::DEBUG); $configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true); if (count($configPrefixes) == 1) { $connector = new OCA\user_ldap\lib\Connection($configPrefixes[0]); $userBackend = new OCA\user_ldap\USER_LDAP(); $userBackend->setConnector($connector); $groupBackend = new OCA\user_ldap\GROUP_LDAP(); $groupBackend->setConnector($connector); } else { $userBackend = new OCA\user_ldap\User_Proxy($configPrefixes); $groupBackend = new OCA\user_ldap\Group_Proxy($configPrefixes); } self::$_backends[$backend] = $userBackend; if (count($configPrefixes) > 0) { // register user backend //~ OC_User::useBackend($userBackend); OC_Group::useBackend($groupBackend); } } } } }
* version 3 of the License, or any later version. * * This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>. * */ OCP\App::registerAdmin('user_ldap', 'settings'); $configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true); if (count($configPrefixes) == 1) { $connector = new OCA\user_ldap\lib\Connection($configPrefixes[0]); $userBackend = new OCA\user_ldap\USER_LDAP(); $userBackend->setConnector($connector); $groupBackend = new OCA\user_ldap\GROUP_LDAP(); $groupBackend->setConnector($connector); } else { $userBackend = new OCA\user_ldap\User_Proxy($configPrefixes); $groupBackend = new OCA\user_ldap\Group_Proxy($configPrefixes); } if (count($configPrefixes) > 0) { // register user backend OC_User::useBackend($userBackend); OC_Group::useBackend($groupBackend); } // add settings page to navigation $entry = array('id' => 'user_ldap_settings', 'order' => 1, 'href' => OCP\Util::linkTo('user_ldap', 'settings.php'), 'name' => 'LDAP'); OCP\Backgroundjob::addRegularTask('OCA\\user_ldap\\lib\\Jobs', 'updateGroups');
* ownCloud - user_ldap * * @author Dominik Schmidt * @copyright 2011 Dominik Schmidt dev@dominik-schmidt.de * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>. * */ OCP\App::registerAdmin('user_ldap', 'settings'); $connector = new OCA\user_ldap\lib\Connection('user_ldap'); $userBackend = new OCA\user_ldap\USER_LDAP(); $userBackend->setConnector($connector); $groupBackend = new OCA\user_ldap\GROUP_LDAP(); $groupBackend->setConnector($connector); // register user backend OC_User::useBackend($userBackend); OC_Group::useBackend($groupBackend); // add settings page to navigation $entry = array('id' => 'user_ldap_settings', 'order' => 1, 'href' => OCP\Util::linkTo('user_ldap', 'settings.php'), 'name' => 'LDAP'); OCP\Backgroundjob::addRegularTask('OCA\\user_ldap\\lib\\Jobs', 'updateGroups');