1
0

deleteConfiguration.php 691 B

1234567891011121314151617181920212223
  1. <?php
  2. use OCA\User_LDAP\Helper;
  3. use OCP\Util;
  4. /**
  5. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  6. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  7. * SPDX-License-Identifier: AGPL-3.0-only
  8. */
  9. // Check user and app status
  10. \OC_JSON::checkAdminUser();
  11. \OC_JSON::checkAppEnabled('user_ldap');
  12. \OC_JSON::callCheck();
  13. $prefix = (string)$_POST['ldap_serverconfig_chooser'];
  14. $helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection());
  15. if ($helper->deleteServerConfiguration($prefix)) {
  16. \OC_JSON::success();
  17. } else {
  18. $l = Util::getL10N('user_ldap');
  19. \OC_JSON::error(['message' => $l->t('Failed to delete the server configuration')]);
  20. }