wizardDetectorUserDisplayNameAttribute.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 let's the wizard backend count the available users
  10. *
  11. * @constructor
  12. */
  13. var WizardDetectorUserDisplayNameAttribute = OCA.LDAP.Wizard.WizardDetectorFilterSimpleRequestAbstract.subClass({
  14. init: function() {
  15. this.setTargetKey('ldap_user_count');
  16. this.wizardMethod = 'detectUserDisplayNameAttribute';
  17. this.runsOnRequest = true;
  18. },
  19. /**
  20. * @inheritdoc
  21. */
  22. run: function(model, configID) {
  23. // default value has capital N. Detected values are always lowercase
  24. if(model.configuration.ldap_display_name && model.configuration.ldap_display_name !== 'displayName') {
  25. // a value is already set. Don't overwrite and don't ask LDAP
  26. // without reason.
  27. return false;
  28. }
  29. this._super(model, configID);
  30. }
  31. });
  32. OCA.LDAP.Wizard.WizardDetectorUserDisplayNameAttribute = WizardDetectorUserDisplayNameAttribute;
  33. })();