BUG 9894 Active Directory User Import not working SOLVED

- Fields deprecated and wrong default filter for the ldap class
- Those parameters are not used, now it is only used the additional filter, with this field you can create the same filters or more complex filters.

Also, we've detected that the filter by default we are using the following condition: (objectCategory=person)

So, your filter is not working anymore, now we have been removed that condition to search in all objects and if you want to limit the objects on which searches can be done, you have to add your own filter.
This commit is contained in:
Julio Cesar Laura
2012-11-27 16:32:20 -04:00
parent 86087f7993
commit 6d7c9f5da7
3 changed files with 60 additions and 134 deletions

View File

@@ -150,7 +150,7 @@ class LDAP
$sFilter = '(&(|(objectClass=*))'; $sFilter = '(&(|(objectClass=*))';
if ( isset( $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE']) && $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE'] == 'ad' ) { if ( isset( $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE']) && $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE'] == 'ad' ) {
$sFilter = "(&(|(objectClass=*))(|(samaccountname=$sKeyword)(userprincipalname=$sKeyword))(objectCategory=person))"; $sFilter = "(&(|(objectClass=*))(|(samaccountname=$sKeyword)(userprincipalname=$sKeyword)))";
} }
else else
$sFilter = "(&(|(objectClass=*))(|(uid=$sKeyword)(cn=$sKeyword)))"; $sFilter = "(&(|(objectClass=*))(|(uid=$sKeyword)(cn=$sKeyword)))";

View File

@@ -48,10 +48,8 @@ Ext.onReady(function(){
listeners:{ listeners:{
select: function(c,d,i){ select: function(c,d,i){
if(i){ if(i){
formAuthSourceE.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'samaccountname' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'userprincipalname' + "\n" + 'telephonenumber');
formAuthSourceE.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('samaccountname'); formAuthSourceE.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('samaccountname');
} else { } else {
formAuthSourceE.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile');
formAuthSourceE.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('uid'); formAuthSourceE.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('uid');
} }
} }
@@ -127,7 +125,7 @@ Ext.onReady(function(){
fieldLabel: _('ID_BASE_DN'), fieldLabel: _('ID_BASE_DN'),
xtype:'textfield', xtype:'textfield',
value:sUID, value:sUID,
width: 200, width: 300,
autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '128'}, autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '128'},
allowBlank: false, allowBlank: false,
listeners: { listeners: {
@@ -221,28 +219,13 @@ Ext.onReady(function(){
} }
} }
}); });
//Object Classes
var txtaClass=new Ext.form.TextArea({
id: 'AUTH_SOURCE_OBJECT_CLASSES',
fieldLabel: _('ID_OBJECT_CLASS'),
xtype:'textarea',
value:'*',
width: 200,
allowBlank: false,
listeners: {
'render': function(c) {
c.getEl().on('keyup', function() {
}, c);
}
}
});
//Additional Filter //Additional Filter
var txtoAddFilter=new Ext.form.TextField({ var txtoAddFilter=new Ext.form.TextField({
id: 'AUTH_SOURCE_ADDITIONAL_FILTER', id: 'AUTH_SOURCE_ADDITIONAL_FILTER',
fieldLabel: _('ID_ADDITIONAL_FILTER'), fieldLabel: _('ID_ADDITIONAL_FILTER'),
xtype:'textfield', xtype:'textfield',
value:'', value:'',
width: 200, width: 300,
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '200'}, autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '200'},
allowBlank: true, allowBlank: true,
listeners: { listeners: {
@@ -252,21 +235,6 @@ Ext.onReady(function(){
} }
} }
}); });
//Attributes
var txtAttributes=new Ext.form.TextArea({
id: 'AUTH_SOURCE_ATTRIBUTES',
fieldLabel: _('ID_ATTRIBUTES'),
xtype:'textArea',
value:'cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile',
width: 200,
allowBlank: false,
listeners: {
'render': function(c) {
c.getEl().on('keyup', function() {
}, c);
}
}
});
//here we are setting the fields //here we are setting the fields
fieldsAS = new Ext.form.FieldSet({ fieldsAS = new Ext.form.FieldSet({
title: _('ID_AUTHENTICATION_SOURCE_INF_TITLE'), title: _('ID_AUTHENTICATION_SOURCE_INF_TITLE'),
@@ -283,9 +251,7 @@ Ext.onReady(function(){
txtSearchUser, txtSearchUser,
txtPassword , txtPassword ,
txtIdentifier, txtIdentifier,
txtaClass,
txtoAddFilter, txtoAddFilter,
txtAttributes
] ]
}); });
@@ -344,11 +310,9 @@ Ext.onReady(function(){
AUTH_SOURCE_SEARCH_USER: formAuthSourceE.getForm().findField('AUTH_SOURCE_SEARCH_USER').getValue(), AUTH_SOURCE_SEARCH_USER: formAuthSourceE.getForm().findField('AUTH_SOURCE_SEARCH_USER').getValue(),
AUTH_SOURCE_PASSWORD: formAuthSourceE.getForm().findField('AUTH_SOURCE_PASSWORD').getValue(), AUTH_SOURCE_PASSWORD: formAuthSourceE.getForm().findField('AUTH_SOURCE_PASSWORD').getValue(),
AUTH_SOURCE_VERSION: formAuthSourceE.getForm().findField('AUTH_SOURCE_VERSION').getValue(), AUTH_SOURCE_VERSION: formAuthSourceE.getForm().findField('AUTH_SOURCE_VERSION').getValue(),
AUTH_SOURCE_BASE_DN: formAuthSourceE.getForm().findField('AUTH_SOURCE_BASE_DN').getValue(), AUTH_SOURCE_BASE_DN: formAuthSourceE.getForm().findField('AUTH_SOURCE_BASE_DN').getValue()
AUTH_SOURCE_OBJECT_CLASSES: formAuthSourceE.getForm().findField('AUTH_SOURCE_OBJECT_CLASSES').getValue(),
AUTH_SOURCE_ATTRIBUTES: formAuthSourceE.getForm().findField('AUTH_SOURCE_ATTRIBUTES').getValue()
}, },
waitMsg : 'testing...', waitMsg : _('ID_SAVING'),
timeout : 3600, timeout : 3600,
success: function(f,a){ success: function(f,a){
@@ -410,8 +374,6 @@ function loadAuthSourceData(sUID, txtSearchUser, txtPassword){
AUTH_SOURCE_IDENTIFIER_FOR_USER: data.sources.AUTH_SOURCE_IDENTIFIER_FOR_USER, AUTH_SOURCE_IDENTIFIER_FOR_USER: data.sources.AUTH_SOURCE_IDENTIFIER_FOR_USER,
AUTH_SOURCE_VERSION: data.sources.AUTH_SOURCE_VERSION, AUTH_SOURCE_VERSION: data.sources.AUTH_SOURCE_VERSION,
AUTH_SOURCE_BASE_DN: data.sources.AUTH_SOURCE_BASE_DN, AUTH_SOURCE_BASE_DN: data.sources.AUTH_SOURCE_BASE_DN,
AUTH_SOURCE_OBJECT_CLASSES: data.sources.AUTH_SOURCE_OBJECT_CLASSES,
AUTH_SOURCE_ATTRIBUTES:data.sources.AUTH_SOURCE_ATTRIBUTES,
AUTH_SOURCE_ADDITIONAL_FILTER:data.sources.AUTH_SOURCE_ADDITIONAL_FILTER AUTH_SOURCE_ADDITIONAL_FILTER:data.sources.AUTH_SOURCE_ADDITIONAL_FILTER
}) })
}, },

View File

@@ -59,10 +59,8 @@ Ext.onReady(function(){
listeners:{ listeners:{
select: function(c,d,i){ select: function(c,d,i){
if(i){ if(i){
formAuthSource.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'samaccountname' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'userprincipalname' + "\n" + 'telephonenumber');
formAuthSource.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('samaccountname'); formAuthSource.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('samaccountname');
} else { } else {
formAuthSource.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile');
formAuthSource.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('uid'); formAuthSource.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('uid');
} }
} }
@@ -143,7 +141,7 @@ Ext.onReady(function(){
fieldLabel: _('ID_BASE_DN'), fieldLabel: _('ID_BASE_DN'),
xtype:'textfield', xtype:'textfield',
value:'', value:'',
width: 200, width: 300,
autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '128'}, autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '128'},
allowBlank: false, allowBlank: false,
listeners: { listeners: {
@@ -239,28 +237,13 @@ Ext.onReady(function(){
} }
} }
}); });
//Object Classes
var txtaClass=new Ext.form.TextArea({
id: 'AUTH_SOURCE_OBJECT_CLASSES',
fieldLabel: _('ID_OBJECT_CLASS'),
xtype:'textarea',
value:'*',
width: 200,
allowBlank: false,
listeners: {
'render': function(c) {
c.getEl().on('keyup', function() {
}, c);
}
}
});
//Additional Filter //Additional Filter
var txtoAddFilter=new Ext.form.TextField({ var txtoAddFilter=new Ext.form.TextField({
id: 'AUTH_SOURCE_ADDITIONAL_FILTER', id: 'AUTH_SOURCE_ADDITIONAL_FILTER',
fieldLabel: _('ID_ADDITIONAL_FILTER'), fieldLabel: _('ID_ADDITIONAL_FILTER'),
xtype:'textfield', xtype:'textfield',
value:'', value:'',
width: 200, width: 300,
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '200'}, autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '200'},
allowBlank: true, allowBlank: true,
listeners: { listeners: {
@@ -270,21 +253,6 @@ Ext.onReady(function(){
} }
} }
}); });
//Attributes
var txtAttributes=new Ext.form.TextArea({
id: 'AUTH_SOURCE_ATTRIBUTES',
fieldLabel: _('ID_ATTRIBUTES'),
xtype:'textArea',
value:'cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile',
width: 200,
allowBlank: false,
listeners: {
'render': function(c) {
c.getEl().on('keyup', function() {
}, c);
}
}
});
//here we are setting the fields //here we are setting the fields
fieldsAS = new Ext.form.FieldSet({ fieldsAS = new Ext.form.FieldSet({
title: _('ID_AUTHENTICATION_SOURCE_INFORMATION'), title: _('ID_AUTHENTICATION_SOURCE_INFORMATION'),
@@ -302,9 +270,7 @@ Ext.onReady(function(){
txtSearchUser, txtSearchUser,
txtPassword , txtPassword ,
txtIdentifier, txtIdentifier,
txtaClass, txtoAddFilter
txtoAddFilter,
txtAttributes
] ]
}); });
@@ -365,12 +331,10 @@ Ext.onReady(function(){
AUTH_SOURCE_PASSWORD: formAuthSource.getForm().findField('AUTH_SOURCE_PASSWORD').getValue(), AUTH_SOURCE_PASSWORD: formAuthSource.getForm().findField('AUTH_SOURCE_PASSWORD').getValue(),
AUTH_SOURCE_VERSION: formAuthSource.getForm().findField('AUTH_SOURCE_VERSION').getValue(), AUTH_SOURCE_VERSION: formAuthSource.getForm().findField('AUTH_SOURCE_VERSION').getValue(),
AUTH_SOURCE_BASE_DN: formAuthSource.getForm().findField('AUTH_SOURCE_BASE_DN').getValue(), AUTH_SOURCE_BASE_DN: formAuthSource.getForm().findField('AUTH_SOURCE_BASE_DN').getValue(),
AUTH_SOURCE_OBJECT_CLASSES: formAuthSource.getForm().findField('AUTH_SOURCE_OBJECT_CLASSES').getValue(),
AUTH_SOURCE_ATTRIBUTES: formAuthSource.getForm().findField('AUTH_SOURCE_ATTRIBUTES').getValue(),
AUTH_SOURCE_ADDITIONAL_FILTER: formAuthSource.getForm().findField('AUTH_SOURCE_ADDITIONAL_FILTER').getValue() AUTH_SOURCE_ADDITIONAL_FILTER: formAuthSource.getForm().findField('AUTH_SOURCE_ADDITIONAL_FILTER').getValue()
}, },
waitMsg : 'testing...', waitMsg : _('ID_SAVING'),
timeout : 3600, timeout : 3600,
success: function(f,a){ success: function(f,a){