留言板

LDAP Custom User Field

Chris Spoehr,修改在10 年前。

LDAP Custom User Field

New Member 帖子: 6 加入日期: 13-9-27 最近的帖子
I am unable to have Liferay 6.1.* import an LDAP field into a custom user field. I've found several forum threads and issue tickets that highlight this as an ongoing issue. Some people saying they get it to work, some reporting they still cannot. In my latest attempt, I followed the steps of this, I thought very promising, post: Liferay 6.1.1 CE and LDAP Custom Fields

I started with a clean install of the 6.1.2-ce-ga3 Tomcat bundle.
In my portal-ext.properties file I put:
ldap.user.custom.mappings=countryaccesslist=countryAccessList\n (tried both w/ and w/out the newline)
(I saw the portal liked to capitalize it "Countryaccesslist" so I've even gone back and tried that.)

I created a custom field on users, "countryaccesslist", with type of "Text".

I created the LDAP server and normal mappings via the UI. I mapped the LDAP field "countryAccessList" to Job Title to verify Liferay could even see it. (It can.)

I logged in as an LDAP user, logged out and back in as an admin. I see no value in that user's countryaccesslist custom field.

I used SQuirrel SQL Client to inspect the values in hypersonic and found this entry amongst them.
<preference>
	<name>ldap.user.custom.mappings.11304</name>
	<value>countryaccesslist=countryAccessList[$NEW_LINE$]</value>
</preference>


I have a hook on the login event to show the LDAP server is indeed 11304.

Have I missed any debugging investigation steps? Does anyone who's gotten this working have advice?
thumbnail
Romain Dequidt,修改在10 年前。

RE: LDAP Custom User Field (答复)

New Member 帖子: 10 加入日期: 13-3-9 最近的帖子
There is a bug in the "populateExpandoAttributes" function of the "PortalLDAPImporterImpl" class (It works with the Entreprise Edition, try the trial version)

Use an "ext" plugin to patch it.

Modify:
if (!expandoMappings.containsKey(name) ||
_ldapUserIgnoreAttributes.contains(name)) {
with
if (expandoMappings.containsKey(name) &&
!_ldapUserIgnoreAttributes.contains(name)) {

Good luck!
Chris Spoehr,修改在10 年前。

RE: LDAP Custom User Field

New Member 帖子: 6 加入日期: 13-9-27 最近的帖子
Thanks, Romain. I came to same conclusion some days after I posted this and once I got debug working on my server. I have the Ext plugin ready, but wasn't able to deploy it with Maven, my preferred method in my environment. (And subject of another thread I started).

Thanks for the confirmation - gives me the confidence to open a JIRA ticket for this.
thumbnail
Romain Dequidt,修改在10 年前。

RE: LDAP Custom User Field

New Member 帖子: 10 加入日期: 13-3-9 最近的帖子
Another post give us a more accurate example:
https://www.liferay.com/fr/community/forums/-/message_boards/message/8083901

Question: The deploy doesn't work? Even using this solution:
https://www.liferay.com/fr/community/forums/-/message_boards/message/17555533

Alexey Melnikov:
You should execute deploy not from folder with parent pom.xml, here you need call mvn install
liferay:deploy command should be called from [artifactId]-ext folder.
Rosemary Li,修改在10 年前。

RE: LDAP Custom User Field

New Member 发布: 1 加入日期: 13-11-15 最近的帖子
thank Romain, it fix my problem when i import custom filed from ldap using 6.1 CE.

Romain Dequidt:
There is a bug in the "populateExpandoAttributes" function of the "PortalLDAPImporterImpl" class (It works with the Entreprise Edition, try the trial version)

Use an "ext" plugin to patch it.

Modify:
if (!expandoMappings.containsKey(name) ||
_ldapUserIgnoreAttributes.contains(name)) {
with
if (expandoMappings.containsKey(name) &&
!_ldapUserIgnoreAttributes.contains(name)) {

Good luck!
thumbnail
Fabio Zambelli,修改在10 年前。

RE: LDAP Custom User Field

Junior Member 帖子: 28 加入日期: 10-2-22 最近的帖子
i'm working on 6.2.0 GA and the bug reported in this thread is solved.
however i've a different issue: i've defined LDAP config via Control Panel and the property ldap.user.custom.mappings.<id>, whose default value is null, overrides the same property defined in portal-ext. for instance, browsing Portal Properties in server administration i found the value ldap.user.custom.mappings.<id> as empty.
in PortalLDAPExporterImpl.exportToLDAP, the user expando mappings are retrieved by LDAPSettingsUtil.getUserExpandoMappings getting props values from db.
there is a way to set ldap.user.custom.mappings.<id> value in Control Panel? i guess not.
have i to hook LDAP configuration in Control Panel to manage also user custom fields?
thumbnail
Fabio Zambelli,修改在10 年前。

RE: LDAP Custom User Field

Junior Member 帖子: 28 加入日期: 10-2-22 最近的帖子
solved with hook.
in edit_ldap_server.jsp
<aui:input label="User Custom Fields" name='<%= "settings--" + PropsKeys.LDAP_USER_CUSTOM_MAPPINGS + postfix + "--" %>' type="text" value='<%= PrefsPropsUtil.getString(company.getCompanyId(), PropsKeys.LDAP_USER_CUSTOM_MAPPINGS + postfix, PropsUtil.get(PropsKeys.LDAP_USER_CUSTOM_MAPPINGS)).replaceAll("\n", "[\\\$NEW_LINE\\\$]") %>' />