server/apps/user_ldap/js/wizard/wizardTabAdvanced.js

331 lines
8.4 KiB
JavaScript
Raw Normal View History

LDAP Wizard Overhaul wizard refactor reimplement save spinners and cursor implement Port detector introduced detector queue, added base dn detector disable input fields when detectors are running introduce spinners for fields that are being updated by detector cache jq element objects consolidate processing of detector results in generic / abstract base class display notification if a detector discovered a problem don't run base dn detector if a base is configured reset detector queue on configuration switch implement functionality check and update of status indicator document ConfigModel jsdoc for controller and main view more documentation implement the user filter tab view so far the multiselects get initialized (not filled yet) and the mode can be switched. mode is also restored. reintroduce filter switch confirmation in admin XP mode new detector for user object classes. so we also load user object classes if necessary and are able to save and show the setting. multiselect trigger save actions now on close only show spinners automatically, when a detector is running 20k limit for object classes preselection test adjust wordings, fix grammar add group (for users tab) detector also includes wording fixes error presentation moved from detectors to view, where it belongs add info label to users page missing wording changes show effective LDAP filter in Assisted Mode add user filter detector implement count button for users and limit all count actions to 1001 for performance reasons make port field a bit bigger. not perfect though. do not detect port automatically implement login filter tab view only load features in assisted mode and don't enable assisted fields while in raw mode add tooltips on login filter checkbox options for better understanding permanently show filter on login tab and also compile login filter in assisted mode test/verify button on login attributes tab, with backend changes. only run wizard requests if your an active tab. also run compile filter requests when switching to assisted mode underline toggle filter links to stress that they are clickable unity user and group tab functionality in common abstract class, add group filter tab view. only detectors and template adjustments left to have group tab implementation complete add object class and group detector for groups as well as filter composer show ldap filter permanently on groups tab introduce input element that can deal better with many groups, will be used with > 40 fix disabling complex group chooser while detection is running hide complex group chooser on config switch fix few more issues with complex chooser make complex group chooser available on Users tab as well detect base dn improvements/changes: - do not look for Base DN automatically, offer a button instead - fix for alternative way to detect a base dn (if agent dn is not given) - do not trigger filter composers on config switch Changes with configuration chooser controls - "New" was removed out of the configuration list - and split into buttons "add" and "copy" - delete button is also now an icon add test button for Base DN reimplement advanced tab. The save button is gone. reimplement expert tab remove unused methods implement mail attribute detector implement user display name attribute detection implement member group association detector replace text input with textarea for raw filter input finish functionality check auto-enable good configurations, as it was before cleanup move save confirmation handling to base class, reduces code duplication enable tabs only if no running save processes are left. move onConfigLoaded to base class, avoids code duplication simplify, save LOCs Test Configuration button to be dealt with in main view as it is a cross-tab element require detectorQueue in constructor cleanup put bootstrap into a function and thus make it testable get rid of old stuff
2015-03-03 10:56:03 +00:00
/**
* Copyright (c) 2015, Arthur Schiwon <blizzz@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
OCA = OCA || {};
(function() {
/**
* @classdesc This class represents the view belonging to the advanced tab
* in the LDAP wizard.
*/
var WizardTabAdvanced = OCA.LDAP.Wizard.WizardTabGeneric.subClass({
/**
* initializes the instance. Always call it after initialization.
*
* @param tabIndex
* @param tabID
*/
init: function (tabIndex, tabID) {
this._super(tabIndex, tabID);
var items = {
// Connection settings
ldap_configuration_active: {
$element: $('#ldap_configuration_active'),
setMethod: 'setConfigurationState'
},
ldap_backup_host: {
$element: $('#ldap_backup_host'),
setMethod: 'setBackupHost'
},
ldap_backup_port: {
$element: $('#ldap_backup_port'),
setMethod: 'setBackupPort'
},
ldap_override_main_server: {
$element: $('#ldap_override_main_server'),
setMethod: 'setOverrideMainServerState'
},
ldap_nocase: {
$element: $('#ldap_nocase'),
setMethod: 'setNoCase'
},
ldap_turn_off_cert_check: {
$element: $('#ldap_turn_off_cert_check'),
setMethod: 'setCertCheckDisabled'
},
ldap_cache_ttl: {
$element: $('#ldap_cache_ttl'),
setMethod: 'setCacheTTL'
},
//Directory Settings
ldap_display_name: {
$element: $('#ldap_display_name'),
setMethod: 'setUserDisplayName'
},
ldap_base_users: {
$element: $('#ldap_base_users'),
setMethod: 'setBaseDNUsers'
},
ldap_attributes_for_user_search: {
$element: $('#ldap_attributes_for_user_search'),
setMethod: 'setSearchAttributesUsers'
},
ldap_group_display_name: {
$element: $('#ldap_group_display_name'),
setMethod: 'setGroupDisplayName'
},
ldap_base_groups: {
$element: $('#ldap_base_groups'),
setMethod: 'setBaseDNGroups'
},
ldap_attributes_for_group_search: {
$element: $('#ldap_attributes_for_group_search'),
setMethod: 'setSearchAttributesGroups'
},
ldap_group_member_assoc_attribute: {
$element: $('#ldap_group_member_assoc_attribute'),
setMethod: 'setGroupMemberAssociationAttribute'
},
ldap_nested_groups: {
$element: $('#ldap_nested_groups'),
setMethod: 'setUseNestedGroups'
},
ldap_paging_size: {
$element: $('#ldap_paging_size'),
setMethod: 'setPagingSize'
},
//Special Attributes
ldap_quota_attr: {
$element: $('#ldap_quota_attr'),
setMethod: 'setQuotaAttribute'
},
ldap_quota_def: {
$element: $('#ldap_quota_def'),
setMethod: 'setQuotaDefault'
},
ldap_email_attr: {
$element: $('#ldap_email_attr'),
setMethod: 'setEmailAttribute'
},
home_folder_naming_rule: {
$element: $('#home_folder_naming_rule'),
setMethod: 'setHomeFolderAttribute'
}
};
this.setManagedItems(items);
},
/**
* Sets the config model for this view and subscribes to some events.
* Also binds the config chooser to the model
*
* @param {OCA.LDAP.Wizard.ConfigModel} configModel
*/
setModel: function(configModel) {
this._super(configModel);
this.configModel.on('configLoaded', this.onConfigLoaded, this);
this.configModel.on('receivedLdapFeature', this.onResultReceived, this);
},
/**
* updates the experienced admin check box
*
* @param {string} isConfigActive contains an int
*/
setConfigurationState: function(isConfigActive) {
this.setElementValue(
this.managedItems.ldap_configuration_active.$element, isConfigActive
);
},
/**
* updates the backup host configuration text field
*
* @param {string} host
*/
setBackupHost: function(host) {
this.setElementValue(this.managedItems.ldap_backup_host.$element, host);
},
/**
* updates the backup port configuration text field
*
* @param {string} port
*/
setBackupPort: function(port) {
this.setElementValue(this.managedItems.ldap_backup_port.$element, port);
},
/**
* sets whether the main server should be overridden or not
*
* @param {string} doOverride contains an int
*/
setOverrideMainServerState: function(doOverride) {
this.setElementValue(
this.managedItems.ldap_override_main_server.$element, doOverride
);
},
/**
* whether the server is case insensitive. This setting does not play
* a role anymore (probably never had).
*
* @param {string} noCase contains an int
*/
setNoCase: function(noCase) {
this.setElementValue(this.managedItems.ldap_nocase.$element, noCase);
},
/**
* sets whether the SSL/TLS certification check shout be disabled
*
* @param {string} doCertCheck contains an int
*/
setCertCheckDisabled: function(doCertCheck) {
this.setElementValue(
this.managedItems.ldap_turn_off_cert_check.$element, doCertCheck
);
},
/**
* sets the time-to-live of the LDAP cache (in seconds)
*
* @param {string} cacheTTL contains an int
*/
setCacheTTL: function(cacheTTL) {
this.setElementValue(this.managedItems.ldap_cache_ttl.$element, cacheTTL);
},
/**
* sets the user display name attribute
*
* @param {string} attribute
*/
setUserDisplayName: function(attribute) {
this.setElementValue(this.managedItems.ldap_display_name.$element, attribute);
},
/**
* sets the Base DN for users
*
* @param {string} base
*/
setBaseDNUsers: function(base) {
this.setElementValue(this.managedItems.ldap_base_users.$element, base);
},
/**
* sets the attributes for user searches
*
* @param {string} attributes
*/
setSearchAttributesUsers: function(attributes) {
this.setElementValue(this.managedItems.ldap_attributes_for_user_search.$element, attributes);
},
/**
* sets the display name attribute for groups
*
* @param {string} attribute
*/
setGroupDisplayName: function(attribute) {
this.setElementValue(this.managedItems.ldap_group_display_name.$element, attribute);
},
/**
* sets the Base DN for groups
*
* @param {string} base
*/
setBaseDNGroups: function(base) {
this.setElementValue(this.managedItems.ldap_base_groups.$element, base);
},
/**
* sets the attributes for group search
*
* @param {string} attributes
*/
setSearchAttributesGroups: function(attributes) {
this.setElementValue(this.managedItems.ldap_attributes_for_group_search.$element, attributes);
},
/**
* sets the attribute for the association of users and groups
*
* @param {string} attribute
*/
setGroupMemberAssociationAttribute: function(attribute) {
this.setElementValue(this.managedItems.ldap_group_member_assoc_attribute.$element, attribute);
},
/**
* enabled or disables the use of nested groups (groups in groups in
* groups)
*
* @param {string} useNestedGroups contains an int
*/
setUseNestedGroups: function(useNestedGroups) {
this.setElementValue(this.managedItems.ldap_nested_groups.$element, useNestedGroups);
},
/**
* sets the size of pages for paged search
*
* @param {string} size contains an int
*/
setPagingSize: function(size) {
this.setElementValue(this.managedItems.ldap_paging_size.$element, size);
},
/**
* sets the email attribute
*
* @param {string} attribute
*/
setEmailAttribute: function(attribute) {
this.setElementValue(this.managedItems.ldap_email_attr.$element, attribute);
},
/**
* sets the quota attribute
*
* @param {string} attribute
*/
setQuotaAttribute: function(attribute) {
this.setElementValue(this.managedItems.ldap_quota_attr.$element, attribute);
},
/**
* sets the default quota for LDAP users
*
* @param {string} quota contains an int
*/
setQuotaDefault: function(quota) {
this.setElementValue(this.managedItems.ldap_quota_def.$element, quota);
},
/**
* sets the attribute for the ownCloud user specific home folder location
*
* @param {string} attribute
*/
setHomeFolderAttribute: function(attribute) {
this.setElementValue(this.managedItems.home_folder_naming_rule.$element, attribute);
},
/**
* deals with the result of the Test Connection test
*
* @param {WizardTabAdvanced} view
* @param {FeaturePayload} payload
*/
onResultReceived: function(view, payload) {
if(payload.feature === 'TestConfiguration') {
OC.Notification.showTemporary(payload.data.message);
}
}
});
OCA.LDAP.Wizard.WizardTabAdvanced = WizardTabAdvanced;
})();