Page 1 of 1

e-mail addresses when using LDAP or DB auth.

PostPosted:Wed Aug 06, 2008 10:10 am
by mmart
Is the openkm-emails.properties file only way to configure users e-mail addresses, especially when using LDAP or database for storing users and roles?

Regards,
Mart Moldau

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Wed Aug 06, 2008 11:32 am
by pavila
In this case, you should implement the es.git.openkm.core.principal.PrincipalAdapter interface.

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Fri Aug 08, 2008 7:09 am
by mmart
Sorry, but can you give me some more guidance. I see only getUsers() and getRoles() in PrincipalAdapter interface.

regards,
Mart Moldau

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Fri Aug 08, 2008 8:54 am
by pavila
You have to implement these two method which should return a list of users and roles in the LDAP. Search in the forum because there is some implemented code.

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Fri Aug 08, 2008 11:13 am
by jllort
Take a look here and on this documentation entry.

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Fri Aug 08, 2008 11:43 am
by mmart
Thank you for the links, jllort. I see that I must implement getMails method in addition to getUsers and getRoles.
But are you sure, that this will work, as I don\'t see this getMails method referenced anywhere in the sources?

regards,
Mart Moldau

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Fri Aug 08, 2008 2:32 pm
by jllort
Get mails is referenced on this classes:
DirectNotificationModule
DirectAuthModule
UsersRolesPrincipalAdapter
PrincipalAdapter ( really the Interface )
DatabasePrincipalAdapter

Note that some of this classes are not on community edition, but someones yes.

Pavila he\'ll give more info about it to you.

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Mon Aug 25, 2008 12:23 pm
by mmart
Hi again

Maybe I\'m missing something, but can\'t find reference to getMails() nowhere in sources.
In the DirectNotificationModule I see user2mail method which gets email addresses from openkm-emails.properties.
For testing purposes I wrote my own PrincipalAdapter, other methods (getUsers and getRoles) got called but no activity for getMails().

Regards,
Mart Moldau

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Mon Aug 25, 2008 4:58 pm
by jllort
Is your principal adapter like this:

public interface PrincipalAdapter {

/**
* Method to retrieve all users from a authentication source.
*
* @return A Collection with all the users.
* @throws PrincipalAdapterException If any error occurs.
*/
public Collection<String> getUsers() throws PrincipalAdapterException;

/**
* Method to retrieve all roles from a authentication source.
*
* @return A Collection with all the roles.
* @throws PrincipalAdapterException If any error occurs.
*/
public Collection<String> getRoles() throws PrincipalAdapterException;

/**
* Method to retrieve the mail from a list of users.
*
* @param users A list of users.
* @return A list of user emails.
* @throws PrincipalAdapterException If any error occurs.
*/
public Collection<String> getMails(Collection<String> users) throws PrincipalAdapterException;
}

If not we\'ve found the problem, because it\'s the actual interface and problably on community edition is not still yet changed. Community edition goes some delayed compared with professional.

Re:e-mail addresses when using LDAP or DB auth.

PostPosted:Tue Aug 26, 2008 5:46 am
by mmart
Yes, my adapters code is currently like this. There are more code in getUsers and getRoles and those are working fine and I can see corresponding messages in debug log, but no activity for getMails method. E-mail addresses are still taken from the properties file.
public class EEPrincipalAdapter implements es.git.openkm.core.PrincipalAdapter {
private static Logger log = LoggerFactory.getLogger(EEPrincipalAdapter.class);

public Collection getUsers() throws es.git.openkm.core.PrincipalAdapterException {
log.debug(\"EE getUsers()\");
ArrayList list = new ArrayList();
//...
return list;
}

public Collection getRoles() throws es.git.openkm.core.PrincipalAdapterException {
log.debug(\"EE getRoles()\");
ArrayList list = new ArrayList();
//...
return list;
}

public Collection getMails(Collection users)
throws PrincipalAdapterException {
log.debug(\"EE getMails()\");
return null;
}

}
Regards,
Mart Moldau