Merge pull request #11478 from owncloud/fix-11448

LDAP: add setting to wizard that disables auto-detection and enables raw mode
This commit is contained in:
blizzz 2014-10-16 15:35:30 +02:00
commit 8553e04a78
12 changed files with 551 additions and 206 deletions

View File

@ -19,7 +19,7 @@ foreach($configPrefixes as $config) {
'user_ldap', $config.'ldap_uuid_user_attribute', 'not existing'); 'user_ldap', $config.'ldap_uuid_user_attribute', 'not existing');
if($state === 'non existing') { if($state === 'non existing') {
$value = \OCP\Config::getAppValue( $value = \OCP\Config::getAppValue(
'user_ldap', $config.'ldap_uuid_attribute', 'auto'); 'user_ldap', $config.'ldap_uuid_attribute', '');
\OCP\Config::setAppValue( \OCP\Config::setAppValue(
'user_ldap', $config.'ldap_uuid_user_attribute', $value); 'user_ldap', $config.'ldap_uuid_user_attribute', $value);
\OCP\Config::setAppValue( \OCP\Config::setAppValue(
@ -30,7 +30,7 @@ foreach($configPrefixes as $config) {
'user_ldap', $config.'ldap_expert_uuid_user_attr', 'not existing'); 'user_ldap', $config.'ldap_expert_uuid_user_attr', 'not existing');
if($state === 'non existing') { if($state === 'non existing') {
$value = \OCP\Config::getAppValue( $value = \OCP\Config::getAppValue(
'user_ldap', $config.'ldap_expert_uuid_attr', 'auto'); 'user_ldap', $config.'ldap_expert_uuid_attr', '');
\OCP\Config::setAppValue( \OCP\Config::setAppValue(
'user_ldap', $config.'ldap_expert_uuid_user_attr', $value); 'user_ldap', $config.'ldap_expert_uuid_user_attr', $value);
\OCP\Config::setAppValue( \OCP\Config::setAppValue(

View File

@ -1 +1 @@
0.4.3 0.4.4

View File

@ -6,6 +6,7 @@
.tablerow { .tablerow {
display: table-row; display: table-row;
white-space: nowrap; white-space: nowrap;
text-align: left;
} }
.tablerow input, .tablerow textarea { .tablerow input, .tablerow textarea {
@ -16,6 +17,10 @@
height: 15px; height: 15px;
} }
#ldap .tablerow label {
margin-left: 3px;
}
.invisible { .invisible {
visibility: hidden; visibility: hidden;
} }
@ -77,6 +82,10 @@
margin: 5px; margin: 5px;
} }
.ldap_count {
line-height: 45px;
}
.ldapSettingControls { .ldapSettingControls {
margin-top: 3px; margin-top: 3px;
} }
@ -103,6 +112,10 @@
vertical-align: bottom; vertical-align: bottom;
} }
#ldap input[type=checkbox] {
width: 15px !important;
}
select[multiple=multiple] + button { select[multiple=multiple] + button {
height: 28px; height: 28px;
padding-top: 6px !important; padding-top: 6px !important;
@ -110,6 +123,18 @@ select[multiple=multiple] + button {
max-width: 40%; max-width: 40%;
} }
.save-cursor {
cursor: wait;
}
#ldap .ldap_saving {
margin-right: 15px;
color: orange;
font-weight: bold;
}
#ldap .ldap_saving img { height: 15px; }
.ldap_config_state_indicator_sign { .ldap_config_state_indicator_sign {
display: inline-block; display: inline-block;
height: 16px; height: 16px;

View File

@ -0,0 +1,100 @@
/**
* Copyright (c) 2014, Arthur Schiwon <blizzz@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
/* global LdapWizard */
/**
* controls behaviour depend on whether the admin is experienced in LDAP or not.
*
* @class
* @param {object} wizard the LDAP Wizard object
* @param {boolean} initialState whether the admin is experienced or not
*/
function ExperiencedAdmin(wizard, initialState) {
this.wizard = wizard;
this._isExperienced = initialState;
if(this._isExperienced) {
this.hideEntryCounters();
}
}
/**
* toggles whether the admin is an experienced one or not
*
* @param {boolean} whether the admin is experienced or not
*/
ExperiencedAdmin.prototype.setExperienced = function(isExperienced) {
this._isExperienced = isExperienced;
if(this._isExperienced) {
this.enableRawMode();
this.hideEntryCounters();
} else {
this.showEntryCounters();
}
};
/**
* answers whether the admin is an experienced one or not
*
* @return {boolean} whether the admin is experienced or not
*/
ExperiencedAdmin.prototype.isExperienced = function() {
return this._isExperienced;
};
/**
* switches all LDAP filters from Assisted to Raw mode.
*/
ExperiencedAdmin.prototype.enableRawMode = function() {
var containers = {
'toggleRawGroupFilter': '#rawGroupFilterContainer',
'toggleRawLoginFilter': '#rawLoginFilterContainer',
'toggleRawUserFilter' : '#rawUserFilterContainer'
};
for(var method in containers) {
if($(containers[method]).hasClass('invisible')) {
this.wizard[method]();
}
}
};
ExperiencedAdmin.prototype.updateUserTab = function(mode) {
this._updateTab(mode, $('#ldap_user_count'));
};
ExperiencedAdmin.prototype.updateGroupTab = function(mode) {
this._updateTab(mode, $('#ldap_group_count'));
};
ExperiencedAdmin.prototype._updateTab = function(mode, $countEl) {
if(mode === LdapWizard.filterModeAssisted) {
$countEl.removeClass('hidden');
} else if(!this._isExperienced) {
$countEl.removeClass('hidden');
} else {
$countEl.addClass('hidden');
}
};
/**
* hide user and group counters, they will be displayed on demand only
*/
ExperiencedAdmin.prototype.hideEntryCounters = function() {
$('#ldap_user_count').addClass('hidden');
$('#ldap_group_count').addClass('hidden');
$('.ldapGetEntryCount').removeClass('hidden');
};
/**
* shows user and group counters, they will be displayed on demand only
*/
ExperiencedAdmin.prototype.showEntryCounters = function() {
$('#ldap_user_count').removeClass('hidden');
$('#ldap_group_count').removeClass('hidden');
$('.ldapGetEntryCount').addClass('hidden');
};

View File

@ -1,19 +1,30 @@
/* global LdapWizard */ /* global LdapWizard */
function LdapFilter(target) { function LdapFilter(target, determineModeCallback) {
this.locked = true; this.locked = true;
this.target = false; this.target = false;
this.mode = LdapWizard.filterModeAssisted; this.mode = LdapWizard.filterModeAssisted;
this.lazyRunCompose = false; this.lazyRunCompose = false;
this.determineModeCallback = determineModeCallback;
this.foundFeatures = false;
this.activated = false;
if( target === 'User' || if( target === 'User' ||
target === 'Login' || target === 'Login' ||
target === 'Group') { target === 'Group') {
this.target = target; this.target = target;
this.determineMode();
} }
} }
LdapFilter.prototype.activate = function() {
if(this.activated) {
return;
}
this.activated = true;
this.determineMode();
};
LdapFilter.prototype.compose = function(callback) { LdapFilter.prototype.compose = function(callback) {
var action; var action;
@ -22,6 +33,11 @@ LdapFilter.prototype.compose = function(callback) {
return false; return false;
} }
if(this.mode === LdapWizard.filterModeRaw) {
//Raw filter editing, i.e. user defined filter, don't compose
return;
}
if(this.target === 'User') { if(this.target === 'User') {
action = 'getUserListFilter'; action = 'getUserListFilter';
} else if(this.target === 'Login') { } else if(this.target === 'Login') {
@ -30,11 +46,6 @@ LdapFilter.prototype.compose = function(callback) {
action = 'getGroupFilter'; action = 'getGroupFilter';
} }
if(!$('#raw'+this.target+'FilterContainer').hasClass('invisible')) {
//Raw filter editing, i.e. user defined filter, don't compose
return;
}
var param = 'action='+action+ var param = 'action='+action+
'&ldap_serverconfig_chooser='+ '&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val()); encodeURIComponent($('#ldap_serverconfig_chooser').val());
@ -44,10 +55,8 @@ LdapFilter.prototype.compose = function(callback) {
LdapWizard.ajax(param, LdapWizard.ajax(param,
function(result) { function(result) {
LdapWizard.applyChanges(result); LdapWizard.applyChanges(result);
if(filter.target === 'User') { filter.updateCount();
LdapWizard.countUsers(); if(filter.target === 'Group') {
} else if(filter.target === 'Group') {
LdapWizard.countGroups();
LdapWizard.detectGroupMemberAssoc(); LdapWizard.detectGroupMemberAssoc();
} }
if(typeof callback !== 'undefined') { if(typeof callback !== 'undefined') {
@ -82,6 +91,7 @@ LdapFilter.prototype.determineMode = function() {
filter.mode + '« of type ' + typeof filter.mode); filter.mode + '« of type ' + typeof filter.mode);
} }
filter.unlock(); filter.unlock();
filter.determineModeCallback(filter.mode);
}, },
function () { function () {
//on error case get back to default i.e. Assisted //on error case get back to default i.e. Assisted
@ -90,10 +100,21 @@ LdapFilter.prototype.determineMode = function() {
filter.mode = LdapWizard.filterModeAssisted; filter.mode = LdapWizard.filterModeAssisted;
} }
filter.unlock(); filter.unlock();
filter.determineModeCallback(filter.mode);
} }
); );
}; };
LdapFilter.prototype.setMode = function(mode) {
if(mode === LdapWizard.filterModeAssisted || mode === LdapWizard.filterModeRaw) {
this.mode = mode;
}
};
LdapFilter.prototype.getMode = function() {
return this.mode;
};
LdapFilter.prototype.unlock = function() { LdapFilter.prototype.unlock = function() {
this.locked = false; this.locked = false;
if(this.lazyRunCompose) { if(this.lazyRunCompose) {
@ -101,3 +122,33 @@ LdapFilter.prototype.unlock = function() {
this.compose(); this.compose();
} }
}; };
LdapFilter.prototype.findFeatures = function() {
//TODO: reset this.foundFeatures when any base DN changes
if(!this.foundFeatures && !this.locked && this.mode === LdapWizard.filterModeAssisted) {
this.foundFeatures = true;
var objcEl, avgrEl;
if(this.target === 'User') {
objcEl = 'ldap_userfilter_objectclass';
avgrEl = 'ldap_userfilter_groups';
} else if (this.target === 'Group') {
objcEl = 'ldap_groupfilter_objectclass';
avgrEl = 'ldap_groupfilter_groups';
} else if (this.target === 'Login') {
LdapWizard.findAttributes();
return;
} else {
return false;
}
LdapWizard.findObjectClasses(objcEl, this.target);
LdapWizard.findAvailableGroups(avgrEl, this.target + "s");
}
};
LdapFilter.prototype.updateCount = function(doneCallback) {
if(this.target === 'User') {
LdapWizard.countUsers(doneCallback);
} else if (this.target === 'Group') {
LdapWizard.countGroups(doneCallback);
}
};

View File

@ -122,7 +122,7 @@ var LdapConfiguration = {
OC.filePath('user_ldap','ajax','clearMappings.php'), OC.filePath('user_ldap','ajax','clearMappings.php'),
'ldap_clear_mapping='+encodeURIComponent(mappingSubject), 'ldap_clear_mapping='+encodeURIComponent(mappingSubject),
function(result) { function(result) {
if(result.status == 'success') { if(result.status === 'success') {
OC.dialogs.info( OC.dialogs.info(
t('user_ldap', 'mappings cleared'), t('user_ldap', 'mappings cleared'),
t('user_ldap', 'Success') t('user_ldap', 'Success')
@ -148,23 +148,32 @@ var LdapWizard = {
userFilter: false, userFilter: false,
loginFilter: false, loginFilter: false,
groupFilter: false, groupFilter: false,
ajaxRequests: {},
ajax: function(param, fnOnSuccess, fnOnError) { ajax: function(param, fnOnSuccess, fnOnError, reqID) {
$.post( if(reqID !== undefined) {
if(LdapWizard.ajaxRequests.hasOwnProperty(reqID)) {
LdapWizard.ajaxRequests[reqID].abort();
}
}
var request = $.post(
OC.filePath('user_ldap','ajax','wizard.php'), OC.filePath('user_ldap','ajax','wizard.php'),
param, param,
function(result) { function(result) {
if(result.status == 'success') { if(result.status === 'success') {
fnOnSuccess(result); fnOnSuccess(result);
} else { } else {
fnOnError(result); fnOnError(result);
} }
} }
); );
if(reqID !== undefined) {
LdapWizard.ajaxRequests[reqID] = request;
}
}, },
applyChanges: function (result) { applyChanges: function (result) {
for (id in result.changes) { for (var id in result.changes) {
LdapWizard.blacklistAdd(id); LdapWizard.blacklistAdd(id);
if(id.indexOf('count') > 0) { if(id.indexOf('count') > 0) {
$('#'+id).text(result.changes[id]); $('#'+id).text(result.changes[id]);
@ -179,28 +188,41 @@ var LdapWizard = {
} }
}, },
enableTabs: function() {
//do not use this function directly, use basicStatusCheck instead.
if(LdapWizard.saveProcesses === 0) {
$('.ldap_action_continue').removeAttr('disabled');
$('.ldap_action_back').removeAttr('disabled');
$('#ldapSettings').tabs('option', 'disabled', []);
}
},
disableTabs: function() {
$('.ldap_action_continue').attr('disabled', 'disabled');
$('.ldap_action_back').attr('disabled', 'disabled');
$('#ldapSettings').tabs('option', 'disabled', [1, 2, 3, 4, 5]);
},
basicStatusCheck: function() { basicStatusCheck: function() {
//criterias to continue from the first tab //criterias to continue from the first tab
// - host, port, user filter, agent dn, password, base dn // - host, port, user filter, agent dn, password, base dn
host = $('#ldap_host').val(); var host = $('#ldap_host').val();
port = $('#ldap_port').val(); var port = $('#ldap_port').val();
agent = $('#ldap_dn').val(); var agent = $('#ldap_dn').val();
pwd = $('#ldap_agent_password').val(); var pwd = $('#ldap_agent_password').val();
base = $('#ldap_base').val(); var base = $('#ldap_base').val();
if((host && port && base) && ((!agent && !pwd) || (agent && pwd))) { if((host && port && base) && ((!agent && !pwd) || (agent && pwd))) {
$('.ldap_action_continue').removeAttr('disabled'); LdapWizard.enableTabs();
$('#ldapSettings').tabs('option', 'disabled', []);
} else { } else {
$('.ldap_action_continue').attr('disabled', 'disabled'); LdapWizard.disableTabs();
$('#ldapSettings').tabs('option', 'disabled', [1, 2, 3, 4, 5]);
} }
}, },
blacklistAdd: function(id) { blacklistAdd: function(id) {
obj = $('#'+id); obj = $('#'+id);
if(!(obj[0].hasOwnProperty('multiple') && obj[0]['multiple'] == true)) { if(!(obj[0].hasOwnProperty('multiple') && obj[0]['multiple'] === true)) {
//no need to blacklist multiselect //no need to blacklist multiselect
LdapWizard.saveBlacklist[id] = true; LdapWizard.saveBlacklist[id] = true;
return true; return true;
@ -244,7 +266,8 @@ var LdapWizard = {
LdapWizard.showInfoBox(t('user_ldap', 'Please specify a Base DN')); LdapWizard.showInfoBox(t('user_ldap', 'Please specify a Base DN'));
LdapWizard.showInfoBox(t('user_ldap', 'Could not determine Base DN')); LdapWizard.showInfoBox(t('user_ldap', 'Could not determine Base DN'));
$('#ldap_base').prop('disabled', false); $('#ldap_base').prop('disabled', false);
} },
'guessBaseDN'
); );
} }
}, },
@ -274,7 +297,8 @@ var LdapWizard = {
LdapWizard.hideSpinner('#ldap_port'); LdapWizard.hideSpinner('#ldap_port');
$('#ldap_port').prop('disabled', false); $('#ldap_port').prop('disabled', false);
LdapWizard.showInfoBox(t('user_ldap', 'Please specify the port')); LdapWizard.showInfoBox(t('user_ldap', 'Please specify the port'));
} },
'guessPortAndTLS'
); );
} }
}, },
@ -317,27 +341,37 @@ var LdapWizard = {
} }
}, },
_countThings: function(method) { _countThings: function(method, spinnerID, doneCallback) {
param = 'action='+method+ param = 'action='+method+
'&ldap_serverconfig_chooser='+ '&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val()); encodeURIComponent($('#ldap_serverconfig_chooser').val());
LdapWizard.ajax(param, LdapWizard.showSpinner(spinnerID);
var request = LdapWizard.ajax(param,
function(result) { function(result) {
LdapWizard.applyChanges(result); LdapWizard.applyChanges(result);
LdapWizard.hideSpinner(spinnerID);
if(doneCallback !== undefined) {
doneCallback(method);
}
}, },
function (result) { function (result) {
// error handling OC.Notification.show('Counting the entries failed with, ' + result.message);
} LdapWizard.hideSpinner(spinnerID);
if(doneCallback !== undefined) {
doneCallback(method);
}
},
method
); );
}, },
countGroups: function() { countGroups: function(doneCallback) {
LdapWizard._countThings('countGroups'); LdapWizard._countThings('countGroups', '#ldap_group_count', doneCallback);
}, },
countUsers: function() { countUsers: function(doneCallback) {
LdapWizard._countThings('countUsers'); LdapWizard._countThings('countUsers', '#ldap_user_count', doneCallback);
}, },
detectEmailAttribute: function() { detectEmailAttribute: function() {
@ -345,7 +379,7 @@ var LdapWizard = {
'&ldap_serverconfig_chooser='+ '&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val()); encodeURIComponent($('#ldap_serverconfig_chooser').val());
//runs in the background, no callbacks necessary //runs in the background, no callbacks necessary
LdapWizard.ajax(param, LdapWizard.applyChanges, function(){}); LdapWizard.ajax(param, LdapWizard.applyChanges, function(){}, 'detectEmailAttribute');
}, },
detectGroupMemberAssoc: function() { detectGroupMemberAssoc: function() {
@ -359,7 +393,8 @@ var LdapWizard = {
}, },
function (result) { function (result) {
// error handling // error handling
} },
'determineGroupMemberAssoc'
); );
}, },
@ -372,7 +407,7 @@ var LdapWizard = {
LdapWizard.ajax(param, LdapWizard.ajax(param,
function(result) { function(result) {
$('#ldap_loginfilter_attributes').find('option').remove(); $('#ldap_loginfilter_attributes').find('option').remove();
for (i in result.options['ldap_loginfilter_attributes']) { for (var i in result.options['ldap_loginfilter_attributes']) {
//FIXME: move HTML into template //FIXME: move HTML into template
attr = result.options['ldap_loginfilter_attributes'][i]; attr = result.options['ldap_loginfilter_attributes'][i];
$('#ldap_loginfilter_attributes').append( $('#ldap_loginfilter_attributes').append(
@ -392,12 +427,13 @@ var LdapWizard = {
{noneSelectedText : 'No attributes found'}); {noneSelectedText : 'No attributes found'});
$('#ldap_loginfilter_attributes').multiselect('disable'); $('#ldap_loginfilter_attributes').multiselect('disable');
LdapWizard.hideSpinner('#ldap_loginfilter_attributes'); LdapWizard.hideSpinner('#ldap_loginfilter_attributes');
} },
'determineAttributes'
); );
}, },
findAvailableGroups: function(multisel, type) { findAvailableGroups: function(multisel, type) {
if(type != 'Users' && type != 'Groups') { if(type !== 'Users' && type !== 'Groups') {
return false; return false;
} }
param = 'action=determineGroupsFor'+encodeURIComponent(type)+ param = 'action=determineGroupsFor'+encodeURIComponent(type)+
@ -408,7 +444,7 @@ var LdapWizard = {
LdapWizard.ajax(param, LdapWizard.ajax(param,
function(result) { function(result) {
$('#'+multisel).find('option').remove(); $('#'+multisel).find('option').remove();
for (i in result.options[multisel]) { for (var i in result.options[multisel]) {
//FIXME: move HTML into template //FIXME: move HTML into template
objc = result.options[multisel][i]; objc = result.options[multisel][i];
$('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>"); $('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>");
@ -435,16 +471,17 @@ var LdapWizard = {
function (result) { function (result) {
LdapWizard.hideSpinner('#'+multisel); LdapWizard.hideSpinner('#'+multisel);
$('#'+multisel).multiselect('disable'); $('#'+multisel).multiselect('disable');
if(type == 'Users') { if(type === 'Users') {
LdapWizard.userFilterAvailableGroupsHasRun = true; LdapWizard.userFilterAvailableGroupsHasRun = true;
LdapWizard.postInitUserFilter(); LdapWizard.postInitUserFilter();
} }
} },
'findAvailableGroupsFor' + type
); );
}, },
findObjectClasses: function(multisel, type) { findObjectClasses: function(multisel, type) {
if(type != 'User' && type != 'Group') { if(type !== 'User' && type !== 'Group') {
return false; return false;
} }
param = 'action=determine'+encodeURIComponent(type)+'ObjectClasses'+ param = 'action=determine'+encodeURIComponent(type)+'ObjectClasses'+
@ -455,7 +492,7 @@ var LdapWizard = {
LdapWizard.ajax(param, LdapWizard.ajax(param,
function(result) { function(result) {
$('#'+multisel).find('option').remove(); $('#'+multisel).find('option').remove();
for (i in result.options[multisel]) { for (var i in result.options[multisel]) {
//FIXME: move HTML into template //FIXME: move HTML into template
objc = result.options[multisel][i]; objc = result.options[multisel][i];
$('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>"); $('#'+multisel).append("<option value='"+objc+"'>"+objc+"</option>");
@ -476,12 +513,13 @@ var LdapWizard = {
}, },
function (result) { function (result) {
LdapWizard.hideSpinner('#'+multisel); LdapWizard.hideSpinner('#'+multisel);
if(type == 'User') { if(type === 'User') {
LdapWizard.userFilterObjectClassesHasRun = true; LdapWizard.userFilterObjectClassesHasRun = true;
LdapWizard.postInitUserFilter(); LdapWizard.postInitUserFilter();
} }
//TODO: error handling //TODO: error handling
} },
'determine' + type + 'ObjectClasses'
); );
}, },
@ -530,23 +568,21 @@ var LdapWizard = {
isConfigurationActiveControlLocked: true, isConfigurationActiveControlLocked: true,
init: function() { init: function() {
LdapWizard.instantiateFilters();
LdapWizard.admin.setExperienced($('#ldap_experienced_admin').is(':checked'));
LdapWizard.basicStatusCheck(); LdapWizard.basicStatusCheck();
LdapWizard.functionalityCheck(); LdapWizard.functionalityCheck();
LdapWizard.isConfigurationActiveControlLocked = false; LdapWizard.isConfigurationActiveControlLocked = false;
}, },
initGroupFilter: function() { initGroupFilter: function() {
LdapWizard.groupFilter = new LdapFilter('Group'); LdapWizard.groupFilter.activate();
LdapWizard.findObjectClasses('ldap_groupfilter_objectclass', 'Group');
LdapWizard.findAvailableGroups('ldap_groupfilter_groups', 'Groups');
LdapWizard.countGroups();
}, },
/** init login filter tab section **/ /** init login filter tab section **/
initLoginFilter: function() { initLoginFilter: function() {
LdapWizard.loginFilter = new LdapFilter('Login'); LdapWizard.loginFilter.activate();
LdapWizard.findAttributes();
}, },
postInitLoginFilter: function() { postInitLoginFilter: function() {
@ -569,30 +605,80 @@ var LdapWizard = {
}); });
}, },
hideTestSpinner:function (countMethod) {
var selector;
if(countMethod === 'countUsers') {
selector = '#rawUserFilterContainer .ldapGetEntryCount';
} else {
selector = '#rawGroupFilterContainer .ldapGetEntryCount';
}
LdapWizard.hideSpinner(selector);
},
/** init user filter tab section **/ /** init user filter tab section **/
instantiateFilters: function() {
delete LdapWizard.userFilter;
LdapWizard.userFilter = new LdapFilter('User', function(mode) {
if(mode === LdapWizard.filterModeAssisted) {
LdapWizard.groupFilter.updateCount();
}
LdapWizard.userFilter.findFeatures();
});
$('#rawUserFilterContainer .ldapGetEntryCount').click(function(event) {
event.preventDefault();
$('#ldap_user_count').text('');
LdapWizard.showSpinner('#rawUserFilterContainer .ldapGetEntryCount');
LdapWizard.userFilter.updateCount(LdapWizard.hideTestSpinner);
LdapWizard.detectEmailAttribute();
$('#ldap_user_count').removeClass('hidden');
});
delete LdapWizard.loginFilter;
LdapWizard.loginFilter = new LdapFilter('Login', function(mode) {
LdapWizard.loginFilter.findFeatures();
});
delete LdapWizard.groupFilter;
LdapWizard.groupFilter = new LdapFilter('Group', function(mode) {
if(mode === LdapWizard.filterModeAssisted) {
LdapWizard.groupFilter.updateCount();
}
LdapWizard.groupFilter.findFeatures();
});
$('#rawGroupFilterContainer .ldapGetEntryCount').click(function(event) {
event.preventDefault();
$('#ldap_group_count').text('');
LdapWizard.showSpinner('#rawGroupFilterContainer .ldapGetEntryCount');
LdapWizard.groupFilter.updateCount(LdapWizard.hideTestSpinner);
LdapWizard.detectGroupMemberAssoc();
$('#ldap_group_count').removeClass('hidden');
});
},
userFilterObjectClassesHasRun: false, userFilterObjectClassesHasRun: false,
userFilterAvailableGroupsHasRun: false, userFilterAvailableGroupsHasRun: false,
initUserFilter: function() { initUserFilter: function() {
LdapWizard.userFilterObjectClassesHasRun = false; LdapWizard.userFilterObjectClassesHasRun = false;
LdapWizard.userFilterAvailableGroupsHasRun = false; LdapWizard.userFilterAvailableGroupsHasRun = false;
LdapWizard.userFilter = new LdapFilter('User'); LdapWizard.userFilter.activate();
LdapWizard.findObjectClasses('ldap_userfilter_objectclass', 'User');
LdapWizard.findAvailableGroups('ldap_userfilter_groups', 'Users');
}, },
postInitUserFilter: function() { postInitUserFilter: function() {
if(LdapWizard.userFilterObjectClassesHasRun && if(LdapWizard.userFilterObjectClassesHasRun &&
LdapWizard.userFilterAvailableGroupsHasRun) { LdapWizard.userFilterAvailableGroupsHasRun) {
LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute); LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute);
LdapWizard.countUsers();
} }
}, },
/** end of init user filter tab section **/ /** end of init user filter tab section **/
onTabChange: function(event, ui) { onTabChange: function(event, ui) {
if(LdapWizard.saveProcesses > 0) {
//do not allow to switch tabs as long as a save process is active
return false;
}
newTabIndex = 0; newTabIndex = 0;
if(ui.newTab[0].id === '#ldapWizard2') { if(ui.newTab[0].id === '#ldapWizard2') {
LdapWizard.initUserFilter(); LdapWizard.initUserFilter();
@ -614,10 +700,10 @@ var LdapWizard = {
processChanges: function(triggerObj) { processChanges: function(triggerObj) {
LdapWizard.hideInfoBox(); LdapWizard.hideInfoBox();
if(triggerObj.id == 'ldap_host' if(triggerObj.id === 'ldap_host'
|| triggerObj.id == 'ldap_port' || triggerObj.id === 'ldap_port'
|| triggerObj.id == 'ldap_dn' || triggerObj.id === 'ldap_dn'
|| triggerObj.id == 'ldap_agent_password') { || triggerObj.id === 'ldap_agent_password') {
LdapWizard.checkPort(); LdapWizard.checkPort();
if($('#ldap_port').val()) { if($('#ldap_port').val()) {
//if Port is already set, check BaseDN //if Port is already set, check BaseDN
@ -625,16 +711,14 @@ var LdapWizard = {
} }
} }
if(triggerObj.id == 'ldap_userlist_filter') { if(triggerObj.id === 'ldap_userlist_filter' && !LdapWizard.admin.isExperienced()) {
LdapWizard.countUsers();
LdapWizard.detectEmailAttribute(); LdapWizard.detectEmailAttribute();
} else if(triggerObj.id == 'ldap_group_filter') { } else if(triggerObj.id === 'ldap_group_filter' && !LdapWizard.admin.isExperienced()) {
LdapWizard.countGroups();
LdapWizard.detectGroupMemberAssoc(); LdapWizard.detectGroupMemberAssoc();
} }
if(triggerObj.id == 'ldap_loginfilter_username' if(triggerObj.id === 'ldap_loginfilter_username'
|| triggerObj.id == 'ldap_loginfilter_email') { || triggerObj.id === 'ldap_loginfilter_email') {
LdapWizard.loginFilter.compose(); LdapWizard.loginFilter.compose();
} }
@ -663,8 +747,8 @@ var LdapWizard = {
values = values + "\n" + resultObj[i].value; values = values + "\n" + resultObj[i].value;
} }
LdapWizard._save($('#'+originalObj)[0], $.trim(values)); LdapWizard._save($('#'+originalObj)[0], $.trim(values));
if(originalObj == 'ldap_userfilter_objectclass' if(originalObj === 'ldap_userfilter_objectclass'
|| originalObj == 'ldap_userfilter_groups') { || originalObj === 'ldap_userfilter_groups') {
LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute); LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute);
//when user filter is changed afterwards, login filter needs to //when user filter is changed afterwards, login filter needs to
//be adjusted, too //be adjusted, too
@ -672,15 +756,19 @@ var LdapWizard = {
LdapWizard.initLoginFilter(); LdapWizard.initLoginFilter();
} }
LdapWizard.loginFilter.compose(); LdapWizard.loginFilter.compose();
} else if(originalObj == 'ldap_loginfilter_attributes') { } else if(originalObj === 'ldap_loginfilter_attributes') {
LdapWizard.loginFilter.compose(); LdapWizard.loginFilter.compose();
} else if(originalObj == 'ldap_groupfilter_objectclass' } else if(originalObj === 'ldap_groupfilter_objectclass'
|| originalObj == 'ldap_groupfilter_groups') { || originalObj === 'ldap_groupfilter_groups') {
LdapWizard.groupFilter.compose(); LdapWizard.groupFilter.compose();
} }
}, },
saveProcesses: 0,
_save: function(object, value) { _save: function(object, value) {
$('#ldap .ldap_saving').removeClass('hidden');
LdapWizard.saveProcesses += 1;
$('#ldap *').addClass('save-cursor');
param = 'cfgkey='+encodeURIComponent(object.id)+ param = 'cfgkey='+encodeURIComponent(object.id)+
'&cfgval='+encodeURIComponent(value)+ '&cfgval='+encodeURIComponent(value)+
'&action=save'+ '&action=save'+
@ -690,10 +778,15 @@ var LdapWizard = {
OC.filePath('user_ldap','ajax','wizard.php'), OC.filePath('user_ldap','ajax','wizard.php'),
param, param,
function(result) { function(result) {
if(result.status == 'success') { LdapWizard.saveProcesses -= 1;
if(LdapWizard.saveProcesses === 0) {
$('#ldap .ldap_saving').addClass('hidden');
$('#ldap *').removeClass('save-cursor');
}
if(result.status === 'success') {
LdapWizard.processChanges(object); LdapWizard.processChanges(object);
} else { } else {
// alert('Oooooooooooh :('); console.log('Could not save value for ' + object.id);
} }
} }
); );
@ -713,12 +806,15 @@ var LdapWizard = {
}, },
toggleRawFilter: function(container, moc, mg, stateVar, modeKey) { toggleRawFilter: function(container, moc, mg, stateVar, modeKey) {
var isUser = moc.indexOf('user') >= 0;
var filter = isUser ? LdapWizard.userFilter : LdapWizard.groupFilter;
//moc = multiselect objectclass //moc = multiselect objectclass
//mg = mutliselect groups //mg = mutliselect groups
if($(container).hasClass('invisible')) { if($(container).hasClass('invisible')) {
filter.setMode(LdapWizard.filterModeRaw);
$(container).removeClass('invisible'); $(container).removeClass('invisible');
$(moc).multiselect('disable'); $(moc).multiselect('disable');
if($(mg).multiselect().attr('disabled') == 'disabled') { if($(mg).multiselect().attr('disabled') === 'disabled') {
LdapWizard[stateVar] = 'disable'; LdapWizard[stateVar] = 'disable';
} else { } else {
LdapWizard[stateVar] = 'enable'; LdapWizard[stateVar] = 'enable';
@ -726,11 +822,13 @@ var LdapWizard = {
$(mg).multiselect('disable'); $(mg).multiselect('disable');
LdapWizard._save({ id: modeKey }, LdapWizard.filterModeRaw); LdapWizard._save({ id: modeKey }, LdapWizard.filterModeRaw);
} else { } else {
filter.setMode(LdapWizard.filterModeAssisted);
filter.findFeatures();
$(container).addClass('invisible'); $(container).addClass('invisible');
$(mg).multiselect(LdapWizard[stateVar]); $(mg).multiselect(LdapWizard[stateVar]);
$(moc).multiselect('enable'); $(moc).multiselect('enable');
LdapWizard._save({ id: modeKey }, LdapWizard.filterModeAssisted); LdapWizard._save({ id: modeKey }, LdapWizard.filterModeAssisted);
if(moc.indexOf('user') >= 0) { if(isUser) {
LdapWizard.blacklistRemove('ldap_userlist_filter'); LdapWizard.blacklistRemove('ldap_userlist_filter');
LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute); LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute);
} else { } else {
@ -740,47 +838,90 @@ var LdapWizard = {
} }
}, },
onToggleRawFilterConfirmation: function(currentMode, callback) {
if(!LdapWizard.admin.isExperienced()
|| currentMode === LdapWizard.filterModeAssisted
) {
return callback(true);
}
var confirmed = OCdialogs.confirm(
'Switching the mode will enable automatic LDAP queries. Depending on your LDAP size they may take a while. Do you still want to switch the mode?',
'Mode switch',
callback
);
},
toggleRawGroupFilter: function() { toggleRawGroupFilter: function() {
LdapWizard.blacklistRemove('ldap_group_filter'); LdapWizard.onToggleRawFilterConfirmation(
LdapWizard.toggleRawFilter('#rawGroupFilterContainer', LdapWizard.groupFilter.getMode(),
'#ldap_groupfilter_objectclass', function(confirmed) {
'#ldap_groupfilter_groups', if(confirmed !== true) {
'groupFilterGroupSelectState', return;
'ldapGroupFilterMode' }
);
LdapWizard.blacklistRemove('ldap_group_filter');
LdapWizard.toggleRawFilter('#rawGroupFilterContainer',
'#ldap_groupfilter_objectclass',
'#ldap_groupfilter_groups',
'groupFilterGroupSelectState',
'ldapGroupFilterMode'
);
LdapWizard.admin.updateGroupTab(LdapWizard.groupFilter.getMode());
}
);
}, },
toggleRawLoginFilter: function() { toggleRawLoginFilter: function() {
LdapWizard.blacklistRemove('ldap_login_filter'); LdapWizard.onToggleRawFilterConfirmation(
container = '#rawLoginFilterContainer'; LdapWizard.loginFilter.getMode(),
if($(container).hasClass('invisible')) { function(confirmed) {
$(container).removeClass('invisible'); if(confirmed !== true) {
action = 'disable'; return;
property = 'disabled'; }
mode = LdapWizard.filterModeRaw;
} else { LdapWizard.blacklistRemove('ldap_login_filter');
$(container).addClass('invisible'); container = '#rawLoginFilterContainer';
action = 'enable'; if($(container).hasClass('invisible')) {
property = false; $(container).removeClass('invisible');
mode = LdapWizard.filterModeAssisted; action = 'disable';
} property = 'disabled';
$('#ldap_loginfilter_attributes').multiselect(action); mode = LdapWizard.filterModeRaw;
$('#ldap_loginfilter_email').prop('disabled', property); } else {
$('#ldap_loginfilter_username').prop('disabled', property); $(container).addClass('invisible');
LdapWizard._save({ id: 'ldapLoginFilterMode' }, mode); action = 'enable';
if(action == 'enable') { property = false;
LdapWizard.loginFilter.compose(); mode = LdapWizard.filterModeAssisted;
} }
LdapWizard.loginFilter.setMode(mode);
LdapWizard.loginFilter.findFeatures();
$('#ldap_loginfilter_attributes').multiselect(action);
$('#ldap_loginfilter_email').prop('disabled', property);
$('#ldap_loginfilter_username').prop('disabled', property);
LdapWizard._save({ id: 'ldapLoginFilterMode' }, mode);
if(action === 'enable') {
LdapWizard.loginFilter.compose();
}
}
);
}, },
toggleRawUserFilter: function() { toggleRawUserFilter: function() {
LdapWizard.blacklistRemove('ldap_userlist_filter'); LdapWizard.onToggleRawFilterConfirmation(
LdapWizard.toggleRawFilter('#rawUserFilterContainer', LdapWizard.userFilter.getMode(),
'#ldap_userfilter_objectclass', function(confirmed) {
'#ldap_userfilter_groups', if(confirmed === true) {
'userFilterGroupSelectState', LdapWizard.blacklistRemove('ldap_userlist_filter');
'ldapUserFilterMode' LdapWizard.toggleRawFilter('#rawUserFilterContainer',
); '#ldap_userfilter_objectclass',
'#ldap_userfilter_groups',
'userFilterGroupSelectState',
'ldapUserFilterMode'
);
LdapWizard.admin.updateUserTab(LdapWizard.userFilter.getMode());
}
}
);
}, },
updateStatusIndicator: function(isComplete) { updateStatusIndicator: function(isComplete) {
@ -837,6 +978,7 @@ $(document).ready(function() {
LdapWizard.initMultiSelect($('#ldap_groupfilter_objectclass'), LdapWizard.initMultiSelect($('#ldap_groupfilter_objectclass'),
'ldap_groupfilter_objectclass', 'ldap_groupfilter_objectclass',
t('user_ldap', 'Select object classes')); t('user_ldap', 'Select object classes'));
$('.lwautosave').change(function() { LdapWizard.save(this); }); $('.lwautosave').change(function() { LdapWizard.save(this); });
$('#toggleRawUserFilter').click(LdapWizard.toggleRawUserFilter); $('#toggleRawUserFilter').click(LdapWizard.toggleRawUserFilter);
$('#toggleRawGroupFilter').click(LdapWizard.toggleRawGroupFilter); $('#toggleRawGroupFilter').click(LdapWizard.toggleRawGroupFilter);
@ -931,4 +1073,10 @@ $(document).ready(function() {
LdapConfiguration.refreshConfig(); LdapConfiguration.refreshConfig();
} }
}); });
expAdminCB = $('#ldap_experienced_admin');
LdapWizard.admin = new ExperiencedAdmin(LdapWizard, expAdminCB.is(':checked'));
expAdminCB.change(function() {
LdapWizard.admin.setExperienced($(this).is(':checked'));
});
}); });

View File

@ -69,6 +69,7 @@ class Configuration {
'ldapConfigurationActive' => false, 'ldapConfigurationActive' => false,
'ldapAttributesForUserSearch' => null, 'ldapAttributesForUserSearch' => null,
'ldapAttributesForGroupSearch' => null, 'ldapAttributesForGroupSearch' => null,
'ldapExperiencedAdmin' => false,
'homeFolderNamingRule' => null, 'homeFolderNamingRule' => null,
'hasPagedResultSupport' => false, 'hasPagedResultSupport' => false,
'hasMemberOfFilterSupport' => false, 'hasMemberOfFilterSupport' => false,
@ -345,52 +346,53 @@ class Configuration {
*/ */
public function getDefaults() { public function getDefaults() {
return array( return array(
'ldap_host' => '', 'ldap_host' => '',
'ldap_port' => '', 'ldap_port' => '',
'ldap_backup_host' => '', 'ldap_backup_host' => '',
'ldap_backup_port' => '', 'ldap_backup_port' => '',
'ldap_override_main_server' => '', 'ldap_override_main_server' => '',
'ldap_dn' => '', 'ldap_dn' => '',
'ldap_agent_password' => '', 'ldap_agent_password' => '',
'ldap_base' => '', 'ldap_base' => '',
'ldap_base_users' => '', 'ldap_base_users' => '',
'ldap_base_groups' => '', 'ldap_base_groups' => '',
'ldap_userlist_filter' => '', 'ldap_userlist_filter' => '',
'ldap_user_filter_mode' => 0, 'ldap_user_filter_mode' => 0,
'ldap_userfilter_objectclass' => '', 'ldap_userfilter_objectclass' => '',
'ldap_userfilter_groups' => '', 'ldap_userfilter_groups' => '',
'ldap_login_filter' => '', 'ldap_login_filter' => '',
'ldap_login_filter_mode' => 0, 'ldap_login_filter_mode' => 0,
'ldap_loginfilter_email' => 0, 'ldap_loginfilter_email' => 0,
'ldap_loginfilter_username' => 1, 'ldap_loginfilter_username' => 1,
'ldap_loginfilter_attributes' => '', 'ldap_loginfilter_attributes' => '',
'ldap_group_filter' => '', 'ldap_group_filter' => '',
'ldap_group_filter_mode' => 0, 'ldap_group_filter_mode' => 0,
'ldap_groupfilter_objectclass' => '', 'ldap_groupfilter_objectclass' => '',
'ldap_groupfilter_groups' => '', 'ldap_groupfilter_groups' => '',
'ldap_display_name' => 'displayName', 'ldap_display_name' => 'displayName',
'ldap_group_display_name' => 'cn', 'ldap_group_display_name' => 'cn',
'ldap_tls' => 1, 'ldap_tls' => 1,
'ldap_nocase' => 0, 'ldap_nocase' => 0,
'ldap_quota_def' => '', 'ldap_quota_def' => '',
'ldap_quota_attr' => '', 'ldap_quota_attr' => '',
'ldap_email_attr' => '', 'ldap_email_attr' => '',
'ldap_group_member_assoc_attribute' => 'uniqueMember', 'ldap_group_member_assoc_attribute' => 'uniqueMember',
'ldap_cache_ttl' => 600, 'ldap_cache_ttl' => 600,
'ldap_uuid_user_attribute' => 'auto', 'ldap_uuid_user_attribute' => 'auto',
'ldap_uuid_group_attribute' => 'auto', 'ldap_uuid_group_attribute' => 'auto',
'home_folder_naming_rule' => '', 'home_folder_naming_rule' => '',
'ldap_turn_off_cert_check' => 0, 'ldap_turn_off_cert_check' => 0,
'ldap_configuration_active' => 0, 'ldap_configuration_active' => 0,
'ldap_attributes_for_user_search' => '', 'ldap_attributes_for_user_search' => '',
'ldap_attributes_for_group_search' => '', 'ldap_attributes_for_group_search' => '',
'ldap_expert_username_attr' => '', 'ldap_expert_username_attr' => '',
'ldap_expert_uuid_user_attr' => '', 'ldap_expert_uuid_user_attr' => '',
'ldap_expert_uuid_group_attr' => '', 'ldap_expert_uuid_group_attr' => '',
'has_memberof_filter_support' => 0, 'has_memberof_filter_support' => 0,
'last_jpegPhoto_lookup' => 0, 'last_jpegPhoto_lookup' => 0,
'ldap_nested_groups' => 0, 'ldap_nested_groups' => 0,
'ldap_paging_size' => 500, 'ldap_paging_size' => 500,
'ldap_experienced_admin' => 0,
); );
} }
@ -400,50 +402,51 @@ class Configuration {
public function getConfigTranslationArray() { public function getConfigTranslationArray() {
//TODO: merge them into one representation //TODO: merge them into one representation
static $array = array( static $array = array(
'ldap_host' => 'ldapHost', 'ldap_host' => 'ldapHost',
'ldap_port' => 'ldapPort', 'ldap_port' => 'ldapPort',
'ldap_backup_host' => 'ldapBackupHost', 'ldap_backup_host' => 'ldapBackupHost',
'ldap_backup_port' => 'ldapBackupPort', 'ldap_backup_port' => 'ldapBackupPort',
'ldap_override_main_server' => 'ldapOverrideMainServer', 'ldap_override_main_server' => 'ldapOverrideMainServer',
'ldap_dn' => 'ldapAgentName', 'ldap_dn' => 'ldapAgentName',
'ldap_agent_password' => 'ldapAgentPassword', 'ldap_agent_password' => 'ldapAgentPassword',
'ldap_base' => 'ldapBase', 'ldap_base' => 'ldapBase',
'ldap_base_users' => 'ldapBaseUsers', 'ldap_base_users' => 'ldapBaseUsers',
'ldap_base_groups' => 'ldapBaseGroups', 'ldap_base_groups' => 'ldapBaseGroups',
'ldap_userfilter_objectclass' => 'ldapUserFilterObjectclass', 'ldap_userfilter_objectclass' => 'ldapUserFilterObjectclass',
'ldap_userfilter_groups' => 'ldapUserFilterGroups', 'ldap_userfilter_groups' => 'ldapUserFilterGroups',
'ldap_userlist_filter' => 'ldapUserFilter', 'ldap_userlist_filter' => 'ldapUserFilter',
'ldap_user_filter_mode' => 'ldapUserFilterMode', 'ldap_user_filter_mode' => 'ldapUserFilterMode',
'ldap_login_filter' => 'ldapLoginFilter', 'ldap_login_filter' => 'ldapLoginFilter',
'ldap_login_filter_mode' => 'ldapLoginFilterMode', 'ldap_login_filter_mode' => 'ldapLoginFilterMode',
'ldap_loginfilter_email' => 'ldapLoginFilterEmail', 'ldap_loginfilter_email' => 'ldapLoginFilterEmail',
'ldap_loginfilter_username' => 'ldapLoginFilterUsername', 'ldap_loginfilter_username' => 'ldapLoginFilterUsername',
'ldap_loginfilter_attributes' => 'ldapLoginFilterAttributes', 'ldap_loginfilter_attributes' => 'ldapLoginFilterAttributes',
'ldap_group_filter' => 'ldapGroupFilter', 'ldap_group_filter' => 'ldapGroupFilter',
'ldap_group_filter_mode' => 'ldapGroupFilterMode', 'ldap_group_filter_mode' => 'ldapGroupFilterMode',
'ldap_groupfilter_objectclass' => 'ldapGroupFilterObjectclass', 'ldap_groupfilter_objectclass' => 'ldapGroupFilterObjectclass',
'ldap_groupfilter_groups' => 'ldapGroupFilterGroups', 'ldap_groupfilter_groups' => 'ldapGroupFilterGroups',
'ldap_display_name' => 'ldapUserDisplayName', 'ldap_display_name' => 'ldapUserDisplayName',
'ldap_group_display_name' => 'ldapGroupDisplayName', 'ldap_group_display_name' => 'ldapGroupDisplayName',
'ldap_tls' => 'ldapTLS', 'ldap_tls' => 'ldapTLS',
'ldap_nocase' => 'ldapNoCase', 'ldap_nocase' => 'ldapNoCase',
'ldap_quota_def' => 'ldapQuotaDefault', 'ldap_quota_def' => 'ldapQuotaDefault',
'ldap_quota_attr' => 'ldapQuotaAttribute', 'ldap_quota_attr' => 'ldapQuotaAttribute',
'ldap_email_attr' => 'ldapEmailAttribute', 'ldap_email_attr' => 'ldapEmailAttribute',
'ldap_group_member_assoc_attribute' => 'ldapGroupMemberAssocAttr', 'ldap_group_member_assoc_attribute' => 'ldapGroupMemberAssocAttr',
'ldap_cache_ttl' => 'ldapCacheTTL', 'ldap_cache_ttl' => 'ldapCacheTTL',
'home_folder_naming_rule' => 'homeFolderNamingRule', 'home_folder_naming_rule' => 'homeFolderNamingRule',
'ldap_turn_off_cert_check' => 'turnOffCertCheck', 'ldap_turn_off_cert_check' => 'turnOffCertCheck',
'ldap_configuration_active' => 'ldapConfigurationActive', 'ldap_configuration_active' => 'ldapConfigurationActive',
'ldap_attributes_for_user_search' => 'ldapAttributesForUserSearch', 'ldap_attributes_for_user_search' => 'ldapAttributesForUserSearch',
'ldap_attributes_for_group_search' => 'ldapAttributesForGroupSearch', 'ldap_attributes_for_group_search' => 'ldapAttributesForGroupSearch',
'ldap_expert_username_attr' => 'ldapExpertUsernameAttr', 'ldap_expert_username_attr' => 'ldapExpertUsernameAttr',
'ldap_expert_uuid_user_attr' => 'ldapExpertUUIDUserAttr', 'ldap_expert_uuid_user_attr' => 'ldapExpertUUIDUserAttr',
'ldap_expert_uuid_group_attr' => 'ldapExpertUUIDGroupAttr', 'ldap_expert_uuid_group_attr' => 'ldapExpertUUIDGroupAttr',
'has_memberof_filter_support' => 'hasMemberOfFilterSupport', 'has_memberof_filter_support' => 'hasMemberOfFilterSupport',
'last_jpegPhoto_lookup' => 'lastJpegPhotoLookup', 'last_jpegPhoto_lookup' => 'lastJpegPhotoLookup',
'ldap_nested_groups' => 'ldapNestedGroups', 'ldap_nested_groups' => 'ldapNestedGroups',
'ldap_paging_size' => 'ldapPagingSize', 'ldap_paging_size' => 'ldapPagingSize',
'ldap_experienced_admin' => 'ldapExperiencedAdmin'
); );
return $array; return $array;
} }

View File

@ -26,6 +26,7 @@
OC_Util::checkAdminUser(); OC_Util::checkAdminUser();
OCP\Util::addScript('user_ldap', 'ldapFilter'); OCP\Util::addScript('user_ldap', 'ldapFilter');
OCP\Util::addScript('user_ldap', 'experiencedAdmin');
OCP\Util::addScript('user_ldap', 'settings'); OCP\Util::addScript('user_ldap', 'settings');
OCP\Util::addScript('core', 'jquery.multiselect'); OCP\Util::addScript('core', 'jquery.multiselect');
OCP\Util::addStyle('user_ldap', 'settings'); OCP\Util::addStyle('user_ldap', 'settings');

View File

@ -30,13 +30,16 @@
placeholder="<?php p($l->t('Raw LDAP filter'));?>" placeholder="<?php p($l->t('Raw LDAP filter'));?>"
title="<?php p($l->t('The filter specifies which LDAP groups shall have access to the %s instance.', $theme->getName()));?>" title="<?php p($l->t('The filter specifies which LDAP groups shall have access to the %s instance.', $theme->getName()));?>"
/> />
<button class="ldapGetEntryCount hidden" name="ldapGetEntryCount" type="button">
<?php p($l->t('Test Filter'));?>
</button>
</p> </p>
<p> <p>
<div class="ldapWizardInfo invisible">&nbsp;</div> <div class="ldapWizardInfo invisible">&nbsp;</div>
</p> </p>
<p> <p class="ldap_count">
<span id="ldap_group_count">0 <?php p($l->t('groups found'));?></span> <span id="ldap_group_count">0 <?php p($l->t('groups found'));?></span>
</p> </p>
<?php print_unescaped($_['wizardControls']); ?> <?php print_unescaped($_['wizardControls']); ?>
</div> </div>
</fieldset> </fieldset>

View File

@ -69,6 +69,16 @@
</textarea> </textarea>
</div> </div>
<div class="tablerow left">
<input type="checkbox" id="ldap_experienced_admin" value="1"
name="ldap_experienced_admin" class="tablecell lwautosave"
title="<?php p($l->t('Avoids automatic LDAP requests. Better for bigger setups, but requires some LDAP knowledge.'));?>"
/>
<label for="ldap_experienced_admin" class="tablecell">
<?php p($l->t('Manually enter LDAP filters (recommended for large directories)'));?>
</label>
</div>
<div class="tablerow"> <div class="tablerow">
<div class="tablecell ldapWizardInfo invisible">&nbsp; <div class="tablecell ldapWizardInfo invisible">&nbsp;
</div> </div>

View File

@ -30,13 +30,16 @@
placeholder="<?php p($l->t('Raw LDAP filter'));?>" placeholder="<?php p($l->t('Raw LDAP filter'));?>"
title="<?php p($l->t('The filter specifies which LDAP users shall have access to the %s instance.', $theme->getName()));?>" title="<?php p($l->t('The filter specifies which LDAP users shall have access to the %s instance.', $theme->getName()));?>"
/> />
<button class="ldapGetEntryCount hidden" name="ldapGetEntryCount" type="button">
<?php p($l->t('Test Filter'));?>
</button>
</p> </p>
<p> <p>
<div class="ldapWizardInfo invisible">&nbsp;</div> <div class="ldapWizardInfo invisible">&nbsp;</div>
</p> </p>
<p> <p class="ldap_count">
<span id="ldap_user_count">0 <?php p($l->t('users found'));?></span> <span id="ldap_user_count">0 <?php p($l->t('users found'));?></span>
</p> </p>
<?php print_unescaped($_['wizardControls']); ?> <?php print_unescaped($_['wizardControls']); ?>
</div> </div>
</fieldset> </fieldset>

View File

@ -1,4 +1,5 @@
<div class="ldapWizardControls"> <div class="ldapWizardControls">
<span class="ldap_saving hidden"><?php p($l->t('Saving'));?> <img class="wizSpinner" src="<?php p(image_path('core', 'loading.gif')); ?>"/></span>
<span class="ldap_config_state_indicator"></span> <span class="ldap_config_state_indicator_sign"></span> <span class="ldap_config_state_indicator"></span> <span class="ldap_config_state_indicator_sign"></span>
<button class="ldap_action_back invisible" name="ldap_action_back" <button class="ldap_action_back invisible" name="ldap_action_back"
type="button"> type="button">