wizardDetectorBaseDN.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * Copyright (c) 2015, Arthur Schiwon <blizzz@owncloud.com>
  3. * This file is licensed under the Affero General Public License version 3 or later.
  4. * See the COPYING-README file.
  5. */
  6. OCA = OCA || {};
  7. (function() {
  8. /**
  9. * @classdesc a Base DN Detector. It executes the auto-detection of the base
  10. * DN by the Nextcloud server, if requirements are met.
  11. *
  12. * @constructor
  13. */
  14. var WizardDetectorBaseDN = OCA.LDAP.Wizard.WizardDetectorGeneric.subClass({
  15. /** @inheritdoc */
  16. init: function() {
  17. this.setTargetKey('ldap_base');
  18. this.runsOnRequest = true;
  19. },
  20. /**
  21. * runs the detector, if specified configuration settings are set and
  22. * base DN is not set.
  23. *
  24. * @param {OCA.LDAP.Wizard.ConfigModel} model
  25. * @param {string} configID - the configuration prefix
  26. * @returns {boolean|jqXHR}
  27. * @abstract
  28. */
  29. run: function(model, configID) {
  30. if( !model.configuration['ldap_host']
  31. || !model.configuration['ldap_port']
  32. )
  33. {
  34. return false;
  35. }
  36. model.notifyAboutDetectionStart(this.getTargetKey());
  37. var params = OC.buildQueryString({
  38. action: 'guessBaseDN',
  39. ldap_serverconfig_chooser: configID
  40. });
  41. return model.callWizard(params, this.processResult, this);
  42. }
  43. });
  44. OCA.LDAP.Wizard.WizardDetectorBaseDN = WizardDetectorBaseDN;
  45. })();