Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Natalie D
Which DB table holds LDAP config? [SOLVED]
October 12, 2012 12:47 AM
Answer

Natalie D

Rank: Junior Member

Posts: 55

Join Date: February 6, 2012

Recent Posts

Hi all
Does somebody know in which database table Liferay stores LDAP configuration?

Of course initial configuration is being read from portal-ext.properties, but any further changes inside Liferay's ControlPanel override those from portal-ext.properties.
Hitoshi Ozawa
RE: Which DB table holds LDAP config?
April 3, 2012 6:13 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

In PortletPreferences in xml format.

If you're going to program, it's the PortletPreferencesLocalServiceUtil
Natalie D
RE: Which DB table holds LDAP config?
April 3, 2012 6:28 AM
Answer

Natalie D

Rank: Junior Member

Posts: 55

Join Date: February 6, 2012

Recent Posts

Hitoshi Ozawa:
In PortletPreferences in xml format.

If you're going to program, it's the PortletPreferencesLocalServiceUtil


Thanks Hitoshi for extremely fast response - but what if I would like to modify property ldap.user.custom.mappings? Is PortletPreferencesLocalServiceUtil a good way to go?

To be honest, I would like to set this property permanently, but changes from portal-ext.properties have no effect - probably due to existing ldap configuration created inside Control Panel.

Natalie
Hitoshi Ozawa
RE: Which DB table holds LDAP config?
April 3, 2012 6:37 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

To be honest, I would like to set this property permanently, but changes from portal-ext.properties have no effect - probably due to existing ldap configuration created inside Control Panel.


So, what you really want to do is to delete the setting you've made in the database and allow portal-ext.properties to become effective once again.
There's an utility to handle xml but that's too complicated and time wasting. A lot easier just deleting the database setting using the API.
Natalie D
RE: Which DB table holds LDAP config?
April 3, 2012 6:42 AM
Answer

Natalie D

Rank: Junior Member

Posts: 55

Join Date: February 6, 2012

Recent Posts

Hitoshi Ozawa:

... A lot easier just deleting the database setting using the API.


Do you know which API serves this purpose?
Hitoshi Ozawa
RE: Which DB table holds LDAP config?
April 3, 2012 7:00 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

It the same API. Look in the database table to see if there's may be some other settings in the xml document. If there isn't you can delete it.

If there is, (now don't tell anybody I told you this because this is a hack and may not work), but if you can take your Liferay server down,
take it down and try deleting the LDAP settings from the xml. AFAIK, xml contents aren't dependent of other entities. (I do this on my development
server, but I drop and recreate Liferay database once a month.)

If this is your production server, probably not a good idea to hack it.

EDIT:
http://www.liferay.com/community/wiki/-/wiki/Main/LDAP

Liferay is ignoring the values in my portal-ext.properties file #
• Ive been changing the values in my portal-ext.properties file, but those changes arent reflected in the portal.. what is going on? Property values can also be set via the GUI/website. Once you "save" properties via the GUI/website, those settings will be saved in the database and those take precedence. In this case,
◦ 1) continue to use the GUI/website to set your property values.
◦ 2) manually remove those saved values from the database. WARNING.. this will remove all your saved values for authentication and you will either be using the default values, or your custom values in portal-ext.properties (if they exist). find the "portletpreferences" table, the record you want to delete will have the following values:
◦ plid=0
◦ portletid=LIFERAY_PORTAL
◦ the "preferences" field will start with "<portlet-preferences><preference><name>ldap.base.dn</name>"
Natalie D
RE: Which DB table holds LDAP config?
April 3, 2012 7:07 AM
Answer

Natalie D

Rank: Junior Member

Posts: 55

Join Date: February 6, 2012

Recent Posts

Hitoshi Ozawa:
It the same API. Look in the database table to see if there's may be some other settings in the xml document. If there isn't you can delete it.

If there is, (now don't tell anybody I told you this because this is a hack and may not work), but if you can take your Liferay server down,
take it down and try deleting the LDAP settings from the xml. AFAIK, xml contents aren't dependent of other entities. (I do this on my development
server, but I drop and recreate Liferay database once a month.)


I'm not sure this is a good way to go...

You may bu suprised, but the only thing I want to do is synchronize custom (expando) attributes with LDAP fields.

I know it should be as easy as setting ldap.user.custom.mappings.0 and ldap.contact.custom.mappings.0 but the problems are existing LDAP servers added from ControlPanel.
Natalie D
RE: Which DB table holds LDAP config?
April 3, 2012 8:35 AM
Answer

Natalie D

Rank: Junior Member

Posts: 55

Join Date: February 6, 2012

Recent Posts

Natalie D:
Hitoshi Ozawa:
It the same API. Look in the database table to see if there's may be some other settings in the xml document. If there isn't you can delete it.

If there is, (now don't tell anybody I told you this because this is a hack and may not work), but if you can take your Liferay server down,
take it down and try deleting the LDAP settings from the xml. AFAIK, xml contents aren't dependent of other entities. (I do this on my development
server, but I drop and recreate Liferay database once a month.)


You may bu suprised, but the only thing I want to do is synchronize custom (expando) attributes with LDAP fields.

I know it should be as easy as setting ldap.user.custom.mappings.0 and ldap.contact.custom.mappings.0 but the problems are existing LDAP servers added from ControlPanel.



I've finally did it! But it is unecessary complicated. And when I imagine that this task should be as easy as adding one textfield for ldap.user.custom.mappings property on the page: Control Panel -> Portal Settings -> Authentication -> LDAP. Ehh!

And I have found a mistake on wiki page:

1) continue to use the GUI/website to set your property values.
2) manually remove those saved values from the database. WARNING.. this will remove all your saved values for authentication and you will either be using the default values, or your custom values in portal-ext.properties (if they exist). find the "portletpreferences" table, the record you want to delete will have the following values:


Table's name is not portletpreferences but portalpreferences.

Hitoshi - big thanks to You. Without Your help I would stuck for even more hours than 8h, that this task took me.

Natalie
Hitoshi Ozawa
RE: Which DB table holds LDAP config?
April 3, 2012 4:49 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

Table's name is not portletpreferences but portalpreferences.


Thanks, just updated the wiki. emoticon
Roshan Qureshi
RE: Which DB table holds LDAP config?
April 5, 2012 5:51 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Thanks Hitoshi for your detail explanation.
Marc Grünewald
RE: Which DB table holds LDAP config?
July 25, 2012 5:35 AM
Answer

Marc Grünewald

Rank: Junior Member

Posts: 45

Join Date: March 20, 2012

Recent Posts

Hello Natalie,

hopefully you'll read this. Could you tell me how you mapped the Custom Fields? I seem to be to stupid to do it. Let's say I have a Custom Field "canSign" on User and want to map that to "whateverattribute" on my LDAP Server. Do you mind telling me how the code would look like?
I would really appreciate that.

Best Regards

Marc
Natalie D
RE: Which DB table holds LDAP config?
July 25, 2012 6:12 AM
Answer

Natalie D

Rank: Junior Member

Posts: 55

Join Date: February 6, 2012

Recent Posts

Hello Marc

It is as simply as setting inside portal-ext.properties:

1
2#
3# When importing and exporting users, the portal will use this mapping to
4# connect LDAP user attributes and portal user's custom (expando) attributes.
5#
6ldap.user.custom.mappings.0=mobilePhone=mobileInLDAP\nlandlinePhone=telephoneNumberInLDAP\ndivision=departmentInLDAP


Unfortunately there is no way to set those via GUI (I mean Liferay Control Panel). It has to be done manually in portal-ext.properties before server's startup.
Best before adding the new LDAP server via GUI (otherwise You would have to set it up manually in the database's table: portalpreferences - as I described in previous posts).

Regards
Natalie
Marc Grünewald
RE: Which DB table holds LDAP config?
July 26, 2012 12:03 AM
Answer

Marc Grünewald

Rank: Junior Member

Posts: 45

Join Date: March 20, 2012

Recent Posts

Hhm okay I see. I thought I'd have to somehow access the ExpandoTables from within the portal-ext to access the Users Custom Fields. Silly me, thanks a lot!

Cheers Marc
Luis Mas
RE: Which DB table holds LDAP config?
October 11, 2012 5:29 PM
Answer

Luis Mas

Rank: Regular Member

Posts: 146

Join Date: May 18, 2009

Recent Posts

Natalie D:
Hello Marc

It is as simply as setting inside portal-ext.properties:

1
2#
3# When importing and exporting users, the portal will use this mapping to
4# connect LDAP user attributes and portal user's custom (expando) attributes.
5#
6ldap.user.custom.mappings.0=mobilePhone=mobileInLDAP\nlandlinePhone=telephoneNumberInLDAP\ndivision=departmentInLDAP


Unfortunately there is no way to set those via GUI (I mean Liferay Control Panel). It has to be done manually in portal-ext.properties before server's startup.
Best before adding the new LDAP server via GUI (otherwise You would have to set it up manually in the database's table: portalpreferences - as I described in previous posts).

Regards
Natalie


I opened a ticket asking for this: http://issues.liferay.com/browse/LPS-30409
Eduardo Pantoja Ramírez
RE: Which DB table holds LDAP config?
August 24, 2013 11:57 AM
Answer

Eduardo Pantoja Ramírez

Rank: New Member

Posts: 3

Join Date: August 24, 2013

Recent Posts

Hi to all,

I have an issue here, i don't know how i did it but i looked into the portalPreferences Table and i found that the expando values i mapped in the portal-ext.properties for the first time are also stored in the XML field of the portletPreferences and now, each time i try to change this preferences in the portal-ext.properties the portal is not updating this mappings, even new mappings to other expando fields are not being updated. i don't want to delete all the preferences from the database because i'm working with a poductive enviroment. What can i do to solve this!, please help me emoticon.
Ahmed Hasan
RE: Which DB table holds LDAP config?
August 25, 2013 7:15 AM
Answer

Ahmed Hasan

Rank: Expert

Posts: 303

Join Date: April 13, 2007

Recent Posts

Hi Sir,

Yes, this is an issue with Liferay and even you change in portal-ext.properties the entries in the table are not getting updated. They make it there during the first time the server is started. You can try changing these values from the admin UI. Hopefully, it should get reflected in the DB. Even if this is not helping you. you manually update the XML in the portalpreferences and portletpreferences table that contain the wrong values, save the record and restart the server. Hope this helps.


Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook