Fórum

LDAP import/export

Danilo Levantesi, modificado 15 Anos atrás.

LDAP import/export

New Member Postagens: 5 Data de Entrada: 17/07/08 Postagens Recentes
Hi to all,
I'm interested in LDAP import/export feature, but I would like to use it without using LDAP as an authentication method (yes, I know, it is a little weird emoticon ).
Looking at source code, it seems that the import does not care if LDAP auth is enabled, but export does.
If I remove the auth check from export code (from PortalLDAPUtil.java), will I have unexpected side effects?

This is the involved code snippet:


public static void exportToLDAP(Contact contact) throws Exception {
  long companyId = contact.getCompanyId();

  if ( /*!isAuthEnabled(companyId) ||*/ !isExportEnabled(companyId)) {
    return;
  }


Many thanks,

Danilo
thumbnail
Jerry Niu, modificado 15 Anos atrás.

RE: LDAP import/export

Expert Postagens: 451 Data de Entrada: 21/06/06 Postagens Recentes
Danilo Levantesi:
I'm interested in LDAP import/export feature, but I would like to use it without using LDAP as an authentication method


The import code for a user is not specific to LDAP. Use it anyway you like.

As for export, that is LDAP specific, but what you export can be done many different ways. You can use the export as a template to communicate with other systems.
Danilo Levantesi, modificado 15 Anos atrás.

RE: LDAP import/export

New Member Postagens: 5 Data de Entrada: 17/07/08 Postagens Recentes
I think I have posted my question in an unclearly form.

I would like to use the provided LDAP import and export capabilities (to be more clear, the ones you can activate using "Enterprise Admin" portlet, under the "Settings"->"Autentication"->"LDAP" tab.

If you check the "Import" checkbox, Liferay will import the users from LDAP, even if the LDAP authentication method is not enabled.
If you check the "Export" checkbox, Liferay will export the users to LDAP, if and only if the LDAP authentication method is enabled.

I would like the "Export"'s behaviour will be the same of the "Import": you can use them even the LDAP authentication is not enabled.
As told in the first post, PortalLDAPUtil.java contains the following code:

public static void exportToLDAP(Contact contact) throws Exception {
  long companyId = contact.getCompanyId();

  if ( !isAuthEnabled(companyId) || !isExportEnabled(companyId)) {
    return;

and I think it explains why the LDAP export capability works only if the LDAP authentication is enabled.

If I change the above code with the following:

public static void exportToLDAP(Contact contact) throws Exception {
  long companyId = contact.getCompanyId();

  if ( !isExportEnabled(companyId)) {
    return;

will I get the desidered behaviour (without side effects)?

Moreover, if I enable more than one authentication method, what is the result?

Many thanks,
Danilo
thumbnail
Jerry Niu, modificado 15 Anos atrás.

RE: LDAP import/export

Expert Postagens: 451 Data de Entrada: 21/06/06 Postagens Recentes
Danilo Levantesi:
Moreover, if I enable more than one authentication method, what is the result?


The best way to get a local install of LDAP. Set it up the way you need for testing. Modify your classes in hooks or EXT and try it out.
thumbnail
amit doshi, modificado 12 Anos atrás.

RE: LDAP import/export

Liferay Master Postagens: 550 Data de Entrada: 29/12/10 Postagens Recentes
Hi Danilo,

I got your approach , for the time being using the default code for export your approach is good .
Because it will get call on UserListener. So anything you modify on user related field or information related to user table then UserListener will get called.
And you will be able to modify the user related field if you are logged in.

But it gives you problem when you are using some custom code in Export method.

Consider you are trying to export the user Image to LDAP and for that you had written code manually in PortalLDAPExporterImpl class.
And also you have to make Imagelistener in order to export Image in LDAP. And consider that you have Image gallery portlet on the page.
So it will happen that even if you are updating the image in image gallery then also it will call Export and it will increase cpu usage and unnecessary call to export method.

Sorry for the poor english.

Hope it helps.

Thanks & Regards,
Amit Doshi