/** * @author Arthur Schiwon <*****@*****.**> * @author Christopher Schäpers <*****@*****.**> * @author Lukas Reschke <*****@*****.**> * @author Morris Jobke <*****@*****.**> * * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * 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/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $prefix = (string) $_POST['ldap_serverconfig_chooser']; $ldapWrapper = new OCA\user_ldap\lib\LDAP(); $connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, $prefix); OCP\JSON::success(array('configuration' => $connection->getConfiguration()));
$uuid = $groupBE->getUUID($newDN); } try { $updateQuery->execute(array($newDN, $uuid, $dn['ldap_dn'])); } catch (Exception $e) { \OCP\Util::writeLog('user_ldap', 'Could not update ' . $object . ' ' . $dn['ldap_dn'] . ' in the mappings table. ', \OCP\Util::WARN); } } } function escapeDN($dn) { $aDN = ldap_explode_dn($dn, false); unset($aDN['count']); foreach ($aDN as $key => $part) { $value = substr($part, strpos($part, '=') + 1); $escapedValue = strtr($value, array(',' => '\\2c', '=' => '\\3d', '+' => '\\2b', '<' => '\\3c', '>' => '\\3e', ';' => '\\3b', '\\' => '\\5c', '"' => '\\22', '#' => '\\23')); $part = str_replace($part, $value, $escapedValue); } $dn = implode(',', $aDN); return $dn; } // SUPPORTED UPGRADE FROM Version 0.3 (ownCloud 4.5) to 0.4 (ownCloud 5) if (!isset($connector)) { $connector = new \OCA\user_ldap\lib\Connection(); } //it is required, that connections do have ldap_configuration_active setting stored in the database $connector->getConfiguration(); $connector->saveConfiguration(); // we don't save it anymore, was a well-meant bad idea. Clean up database. $query = OC_DB::prepare('DELETE FROM `*PREFIX*preferences` WHERE `appid` = ? AND `configkey` = ?'); $query->execute(array('user_ldap', 'homedir'));