1
0

deleteConfiguration.php 670 B

1234567891011121314151617181920
  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. $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
  13. if ($helper->deleteServerConfiguration($prefix)) {
  14. \OC_JSON::success();
  15. } else {
  16. $l = \OCP\Util::getL10N('user_ldap');
  17. \OC_JSON::error(['message' => $l->t('Failed to delete the server configuration')]);
  18. }