getConfiguration.php 755 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. // Check user and app status
  8. \OC_JSON::checkAdminUser();
  9. \OC_JSON::checkAppEnabled('user_ldap');
  10. \OC_JSON::callCheck();
  11. $prefix = (string)$_POST['ldap_serverconfig_chooser'];
  12. $ldapWrapper = new OCA\User_LDAP\LDAP();
  13. $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
  14. $configuration = $connection->getConfiguration();
  15. if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') {
  16. // hide password
  17. $configuration['ldap_agent_password'] = '**PASSWORD SET**';
  18. }
  19. \OC_JSON::success(['configuration' => $configuration]);