getConfiguration.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Juan Pablo Villafáñez <jvillafanez@solidgear.es>
  8. * @author Lukas Reschke <lukas@statuscode.ch>
  9. * @author Morris Jobke <hey@morrisjobke.de>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. // Check user and app status
  27. \OC_JSON::checkAdminUser();
  28. \OC_JSON::checkAppEnabled('user_ldap');
  29. \OC_JSON::callCheck();
  30. $prefix = (string)$_POST['ldap_serverconfig_chooser'];
  31. $ldapWrapper = new OCA\User_LDAP\LDAP();
  32. $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
  33. $configuration = $connection->getConfiguration();
  34. if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') {
  35. // hide password
  36. $configuration['ldap_agent_password'] = '**PASSWORD SET**';
  37. }
  38. \OC_JSON::success(array('configuration' => $configuration));