1
0

getConfiguration.php 766 B

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