wizardDetectorPort.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-FileCopyrightText: 2015 ownCloud, Inc.
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. OCA = OCA || {};
  7. (function() {
  8. /**
  9. * @classdesc a Port Detector. It executes the auto-detection of the port
  10. * by the Nextcloud server, if requirements are met.
  11. *
  12. * @constructor
  13. */
  14. var WizardDetectorPort = OCA.LDAP.Wizard.WizardDetectorGeneric.subClass({
  15. /** @inheritdoc */
  16. init: function() {
  17. this.setTargetKey('ldap_port');
  18. this.runsOnRequest = true;
  19. },
  20. /**
  21. * runs the detector, if port is not set.
  22. *
  23. * @param {OCA.LDAP.Wizard.ConfigModel} model
  24. * @param {string} configID - the configuration prefix
  25. * @returns {boolean|jqXHR}
  26. * @abstract
  27. */
  28. run: function(model, configID) {
  29. model.notifyAboutDetectionStart('ldap_port');
  30. var params = OC.buildQueryString({
  31. action: 'guessPortAndTLS',
  32. ldap_serverconfig_chooser: configID
  33. });
  34. return model.callWizard(params, this.processResult, this);
  35. }
  36. });
  37. OCA.LDAP.Wizard.WizardDetectorPort = WizardDetectorPort;
  38. })();