AnsweredAssumed Answered

External user database synchronization: duplicated user

Question asked by andrepra on Apr 1, 2009
Latest reply on Apr 2, 2009 by andrepra

I wrote some classes to perform the synchronization with an external user database following the LDAP examples. I wrote MyDatabasePersonExportSource to generate the export and the PersonServiceImpl to override the method getDefaultProperties() for user created on demand at login.
I use this classes from version 1.4 of Alfresco without problems. Recently I upgraded to Alfresco 3.0 (community final). I start get some problems related to some duplicated users.
I start debug the source to understand what happen and I see that at the end of the method  generateExport of the ExportSource implementation there's a check for the existance of the user.

if (personService.personExists(uid)) {

The method  personExists of the PersonServiceImpl call the method getPersonOrNull of the PersonDaoImpl that executes this query

SQLQuery query = getSession().createSQLQuery("SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON = p.node_id JOIN alf_child_assoc c on c.child_node_id = WHERE c.qname_localname = :userName1 AND p.qname_id = :qnameId AND p.string_value = :userName2 and n.node_deleted = :False");
                query.addEntity("n", NodeImpl.class);
                query.setParameter("qnameId", qNameId);
                query.setParameter("userName1", searchUserName);
                query.setParameter("userName2", searchUserName);
                query.setParameter("False", Boolean.FALSE);
                return query.list();
where qNameId = 98 and searchUserName is the userid to check.
Debugging I saw that the results of this query is always empty. So the check return always false.

I tried to execute the query directly on database with an administration console and return 1 record. Very strange.

I found the problem on these configurations:
Alfresco 3 stable
Database: MySQL 5.0.21 and 5.0.49
JDBC: jdbc connector 5.0.3
O.S.: Windows and Linux

My previous post: