组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
LDAP Mapping and Custom attributes Stéphane Nobilet 2009年2月10日 上午3:10
RE: LDAP Mapping and Custom attributes Tim Simon 2009年2月24日 下午7:40
RE: LDAP Mapping and Custom attributes Tony Lim 2009年6月22日 上午11:19
RE: LDAP Mapping and Custom attributes Tony Lim 2009年7月17日 上午8:37
RE: LDAP Mapping and Custom attributes Gloria Muñoz 2009年7月27日 上午3:06
RE: LDAP Mapping and Custom attributes Tony Lim 2009年7月27日 下午4:37
RE: LDAP Mapping and Custom attributes Gloria Muñoz 2009年7月28日 上午3:06
RE: LDAP Mapping and Custom attributes Nagendra Kumar Busam 2009年8月10日 上午2:16
RE: LDAP Mapping and Custom attributes Nagendra Kumar Busam 2009年8月10日 上午8:37
RE: LDAP Mapping and Custom attributes Gloria Muñoz 2009年8月24日 上午2:00
RE: LDAP Mapping and Custom attributes Nagendra Kumar Busam 2009年8月24日 上午4:18
RE: LDAP Mapping and Custom attributes Mario Fischer 2009年9月7日 上午6:05
RE: LDAP Mapping and Custom attributes Gloria Muñoz 2009年9月7日 上午7:43
RE: LDAP Mapping and Custom attributes Mario Fischer 2009年9月8日 上午7:55
RE: LDAP Mapping and Custom attributes Gloria Muñoz 2009年9月14日 上午12:28
RE: LDAP Mapping and Custom attributes Mario Fischer 2009年9月21日 上午2:25
RE: LDAP Mapping and Custom attributes Jeff Williams 2009年9月21日 下午2:57
RE: LDAP Mapping and Custom attributes Jeff Williams 2009年8月26日 上午7:39
RE: LDAP Mapping and Custom attributes Tony Lim 2009年9月30日 上午8:51
RE: LDAP Mapping and Custom attributes Jeff Williams 2009年10月2日 下午12:46
RE: LDAP Mapping and Custom attributes sricanth arroju 2009年12月23日 上午6:28
RE: LDAP Mapping and Custom attributes Bruno Vernay 2010年10月20日 上午5:46
RE: LDAP Mapping and Custom attributes Bhanu P Kondeti 2010年1月26日 下午9:28
RE: LDAP Mapping and Custom attributes vikash kumar chaurasia 2010年2月24日 下午8:24
Stéphane Nobilet
LDAP Mapping and Custom attributes
2009年2月10日 上午3:10
答复

Stéphane Nobilet

等级: Regular Member

帖子: 100

加入日期: 2008年2月28日

最近的帖子

It's possible to configure a LDAP Mapping with the custom attributes ?

Thanks .
Tim Simon
RE: LDAP Mapping and Custom attributes
2009年2月24日 下午7:40
答复

Tim Simon

等级: New Member

帖子: 2

加入日期: 2008年2月26日

最近的帖子

i also have the same question.
Tony Lim
RE: LDAP Mapping and Custom attributes
2009年6月22日 上午11:19
答复

Tony Lim

等级: Junior Member

帖子: 90

加入日期: 2009年4月14日

最近的帖子

same question, anyone have an answer for this?
Tony Lim
RE: LDAP Mapping and Custom attributes
2009年7月17日 上午8:37
答复

Tony Lim

等级: Junior Member

帖子: 90

加入日期: 2009年4月14日

最近的帖子

Yes, under PortalLDAPUtil.java. you can add custom variables:

 1        String[] mappedUserAttributeIds = {
 2            userMappings.getProperty("screenName"),
 3            userMappings.getProperty("emailAddress"),
 4            userMappings.getProperty("fullName"),
 5            userMappings.getProperty("firstName"),
 6            userMappings.getProperty("middleName"),
 7            userMappings.getProperty("lastName"),
 8            userMappings.getProperty("jobTitle"),
 9            userMappings.getProperty("group"),
10            "custom1"
11
12        };


then you can call the variable like so:

1String userId = LDAPUtil.getAttributeValue(attributes, "custom1");
2        serviceContext.setUserId(Long.valueOf(userId));


Stéphane Nobilet:
It's possible to configure a LDAP Mapping with the custom attributes ?

Thanks .
Gloria Muñoz
RE: LDAP Mapping and Custom attributes
2009年7月27日 上午3:06
答复

Gloria Muñoz

等级: Junior Member

帖子: 47

加入日期: 2008年11月4日

最近的帖子

Hello,

I'm also trying to map ldap with custom attributes (phone number) but I cannot finish properly the users update/addition .

I mean, I've added an officePhone attribute, so I got:
 1String[] mappedUserAttributeIds = {
 2            userMappings.getProperty("screenName"),
 3            userMappings.getProperty("emailAddress"),
 4            [b]userMappings.getProperty("officePhone"),[/b]
 5            userMappings.getProperty("baseOffice"),
 6            userMappings.getProperty("fullName"),
 7            userMappings.getProperty("firstName"),
 8            userMappings.getProperty("middleName"),
 9            userMappings.getProperty("lastName"),
10            userMappings.getProperty("jobTitle"),
11            userMappings.getProperty("group")
12        };


The conexion with ldap is working and I can read that new attribute with
1String officePhone = LDAPUtil.getAttributeValue(attrs, userMappings.getProperty("officePhone"));


The problem appears when I try to save that attribute to the database. I've created a "custom attribute" through the GUI called "office-phone", so in importLDAPUser function (PortalLDAPUtil.java) I've added:
1Map<String, Serializable> expandoBridgeAttributes=new LinkedHashMap<String, Serializable>();
2        expandoBridgeAttributes.put("office-phone", officePhone);       
3        serviceContext.setExpandoBridgeAttributes(expandoBridgeAttributes);


Because, as far as I know, that is the way I have to specify values for new custom attributes..am I right?

The problem is that I got the following error when making the addition of the new "expando value":
ERROR [ExpandoBridgeImpl:255] com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
at com.liferay.portal.service.base.PrincipalBean.getPermissionChecker(PrincipalBean.java:77)
at com.liferay.portlet.expando.service.impl.ExpandoValueServiceImpl.addValue(ExpandoValueServiceImpl.java:51)
at sun.reflect.GeneratedMethodAccessor354.invoke(Unknown Source)...

Does it means anything to you?

Any help would be appreciated.

Thanks!
Tony Lim
RE: LDAP Mapping and Custom attributes
2009年7月27日 下午4:37
答复

Tony Lim

等级: Junior Member

帖子: 90

加入日期: 2009年4月14日

最近的帖子

I had the same problem. Here is a patch to fix it.

http://issues.liferay.com/browse/LPS-3070
Gloria Muñoz
RE: LDAP Mapping and Custom attributes
2009年7月28日 上午3:06
答复

Gloria Muñoz

等级: Junior Member

帖子: 47

加入日期: 2008年11月4日

最近的帖子

Perfect! That's it!

Thanks Tony
Nagendra Kumar Busam
RE: LDAP Mapping and Custom attributes
2009年8月10日 上午2:16
答复

Nagendra Kumar Busam

等级: Liferay Master

帖子: 637

加入日期: 2009年7月7日

最近的帖子

Hi Gloria,

Can you let me know the exact steps needed to import other LDAP attributes

I want to import few more attributes (mobile,homePhone,facsimileTelephoneNumber,employeeNumber,homePostalAddress) from LDAP apart from default ones mentioned in LDAP settings.

Thanks in advance
Nagendra Kumar Busam
RE: LDAP Mapping and Custom attributes
2009年8月10日 上午8:37
答复

Nagendra Kumar Busam

等级: Liferay Master

帖子: 637

加入日期: 2009年7月7日

最近的帖子

I tried with the steps mentioned in forum. BUT i was getting NullPointerException for method addValue of ExpandoValueLocalServiceUtil

Here is my code at UserLocalServiceImpl:

for (Map.Entry<String, Serializable> entry : serviceContext.getExpandoBridgeAttributes().entrySet()) {
if (!entry.getKey().isEmpty() && !entry.getValue().equals("") ) {
if (entry.getKey().equals("phone")) {
System.out.println("In phone");
ExpandoValueLocalServiceUtil.addValue("com.liferay.portal.model.Phone",
"phone",
"number_",
user.getPrimaryKey(),
entry.getValue());
} else {
System.out.println("postalCode - zip");
ExpandoValueLocalServiceUtil.addValue("com.liferay.portal.model.Address",
"address",
"zip",
user.getPrimaryKey(),
entry.getValue());
}

}

Any help ?
Gloria Muñoz
RE: LDAP Mapping and Custom attributes
2009年8月24日 上午2:00
答复

Gloria Muñoz

等级: Junior Member

帖子: 47

加入日期: 2008年11月4日

最近的帖子

Hi Nagendra,

I've been on holidays hope it's not too late..

I map the additional attributes in PortalLDAPUtil.java. I've only modified the UserLocalServiceImpl.java to replace the default calling to ExpandoBridge with ExpandoValueLocalServiceUtil.

So in UserLocalServiceImpl.java, around line 350 and 2285 I've replaced
1ExpandoBridge expandoBridge = user.getExpandoBridge();
2
3expandoBridge.setIndexEnabled(false);
4expandoBridge.setAttributes(serviceContext);

with
 1if (  serviceContext.getExpandoBridgeAttributes() != null ) {
 2            for (Map.Entry<String, Serializable> entry : serviceContext.getExpandoBridgeAttributes().entrySet()) {
 3                ExpandoValueLocalServiceUtil.addValue(User.class.getName(),
 4                                                      ExpandoTableConstants.DEFAULT_TABLE_NAME,
 5                                                      entry.getKey(),
 6                                                      user.getUserId(),
 7                                                      entry.getValue());            
 8            }
 9}


and in PortalLDAPUtil.java you should modify getUserAttributes function to map your additional attributes like this(eg "mobile"):
 1String[] mappedUserAttributeIds = {
 2            userMappings.getProperty("screenName"),
 3            userMappings.getProperty("emailAddress"),
 4            userMappings.getProperty("fullName"),
 5            userMappings.getProperty("firstName"),
 6            userMappings.getProperty("middleName"),
 7            userMappings.getProperty("lastName"),
 8            userMappings.getProperty("jobTitle"),
 9            userMappings.getProperty("group"),
10            "mobile"
11        };

and then add to importLDAPUser function the following:
1String mobile = LDAPUtil.getAttributeValue(attrs, "mobile");
2            if(Validator.isNotNull(mobile)){
3                expandoBridgeAttributes.put("mobile", mobile);       
4            }


Hope it helps!
Nagendra Kumar Busam
RE: LDAP Mapping and Custom attributes
2009年8月24日 上午4:18
答复

Nagendra Kumar Busam

等级: Liferay Master

帖子: 637

加入日期: 2009年7月7日

最近的帖子

Hi Gloria,

First of all thank you for your reply. The code what you have provided was really helpful.

One quick question: After making changes according to your inputs,i got the following error (I m hoping it was at ExpandoTableConstants.DEFAULT_TABLE_NAME). If that is the error, Please clarify me how to go ahead

10:54:56,250 ERROR [PortalLDAPUtil:876] Problem adding user with screen name testuser4 and email address btnkumar@gmail.com
java.lang.NullPointerException
at com.liferay.portlet.expando.service.impl.ExpandoValueLocalServiceImpl.addValue(ExpandoValueLocalServiceImpl.java:372)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy98.addValue(Unknown Source)
at com.liferay.portlet.expando.service.ExpandoValueLocalServiceUtil.addValue(ExpandoValueLocalServiceUtil.java:232)
at com.liferay.portal.service.impl.UserLocalServiceImpl.addUser(UserLocalServiceImpl.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Attached the full log of the error for reference.


Thanks,
- Nagendra Kumar
附件: ldap-log-logging3.txt (25.0k)
Jeff Williams
RE: LDAP Mapping and Custom attributes
2009年8月26日 上午7:39
答复

Jeff Williams

等级: Regular Member

帖子: 107

加入日期: 2008年7月15日

最近的帖子

I'm unable to resolve expandoBridgeAttributes here, no matter what I do. Has anyone else had this problem?
Mario Fischer
RE: LDAP Mapping and Custom attributes
2009年9月7日 上午6:05
答复

Mario Fischer

等级: New Member

帖子: 3

加入日期: 2009年9月7日

最近的帖子

Same problem here, mapping attributes always throws this:

10:30:50,845 ERROR [PortalLDAPUtil:949] Problem adding user with screen name ......... and email address .......
java.lang.NullPointerException
at com.liferay.portlet.expando.service.impl.ExpandoValueLocalServiceImpl.addValue(ExpandoValueLocalServiceImpl.java:372)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
.....


..after applying aforementioned patch.

Any ideas?

Regards,
mario
Gloria Muñoz
RE: LDAP Mapping and Custom attributes
2009年9月7日 上午7:43
答复

Gloria Muñoz

等级: Junior Member

帖子: 47

加入日期: 2008年11月4日

最近的帖子

Liferay-administration-guide-5.2.4:

there are five fields that Liferay requires to be mapped in order for the user to be recognized. You must define a mapping to the cor-
responding attributes in LDAP for the following Liferay fields:
Screen Name
Password
Email Address
First Name
Last Name


This error uses to be due to the lack of one of the attributes above. I mean, if you're trying to import a user who hasn't defined one of those attributes (he hasn't an email address associated, or Last Name..).
There are also "validator" functions implemented, which prevent some users from being imported. Eg: ScreenNameValidator.java don't allow users with underlines nor slash in their screen name to be imported.

You can check these things using "system.out" in your code..

HTH
Mario Fischer
RE: LDAP Mapping and Custom attributes
2009年9月8日 上午7:55
答复

Mario Fischer

等级: New Member

帖子: 3

加入日期: 2009年9月7日

最近的帖子

Hi -

thanks for your fast response!

Gloria Muñoz:

This error uses to be due to the lack of one of the attributes above. I mean, if you're trying to import a user who hasn't defined one of those attributes (he hasn't an email address associated, or Last Name..).
There are also "validator" functions implemented, which prevent some users from being imported. Eg: ScreenNameValidator.java don't allow users with underlines nor slash in their screen name to be imported.

HTH


Unfortunately this isn't the cause of the problem, only if I try to map custom attributes to LDAP fields as described above the exception appears.

I think I have identified the problem somewhat further:

1
214:53:04,701 ERROR [PortalLDAPUtil:985] Problem adding user with screen name XXXX and email address YYYY
3com.liferay.portlet.expando.NoSuchTableException: No ExpandoTable exists with the key {companyId=0, classNameId=10038, name=DEFAULT_TABLE}
4        at com.liferay.portlet.expando.service.persistence.ExpandoTablePersistenceImpl.findByC_C_N(ExpandoTablePersistenceImpl.java:654)
5        at com.liferay.portlet.expando.service.impl.ExpandoTableLocalServiceImpl.getTable(ExpandoTableLocalServiceImpl.java:186)
6        at com.liferay.portlet.expando.service.impl.ExpandoTableLocalServiceImpl.getTable(ExpandoTableLocalServiceImpl.java:195)


(This was the root cause for column.getType() to throw the aforementioned Nullpointerexception).


Any ideas..?


Thx in advance,
Mario
Gloria Muñoz
RE: LDAP Mapping and Custom attributes
2009年9月14日 上午12:28
答复

Gloria Muñoz

等级: Junior Member

帖子: 47

加入日期: 2008年11月4日

最近的帖子

..sorry, still not able to help on this, keep digging..
have you made any progress??

Cheers
Mario Fischer
RE: LDAP Mapping and Custom attributes
2009年9月21日 上午2:25
答复

Mario Fischer

等级: New Member

帖子: 3

加入日期: 2009年9月7日

最近的帖子

Yes, it seems the companyId value was 0 - which causes these problems.
Jeff Williams
RE: LDAP Mapping and Custom attributes
2009年9月21日 下午2:57
答复

Jeff Williams

等级: Regular Member

帖子: 107

加入日期: 2008年7月15日

最近的帖子

Gloria Muñoz:
..sorry, still not able to help on this, keep digging..
have you made any progress??

Cheers


Still no-go for me. Can anyone attach an example of this working for 5.2.3?
Tony Lim
RE: LDAP Mapping and Custom attributes
2009年9月30日 上午8:51
答复

Tony Lim

等级: Junior Member

帖子: 90

加入日期: 2009年4月14日

最近的帖子

follow the patch listed in this bug report.

http://issues.liferay.com/browse/LPS-3070
Jeff Williams
RE: LDAP Mapping and Custom attributes
2009年10月2日 下午12:46
答复

Jeff Williams

等级: Regular Member

帖子: 107

加入日期: 2008年7月15日

最近的帖子

I have used that patch, but still no-go. I'm totally stumped here.
sricanth arroju
RE: LDAP Mapping and Custom attributes
2009年12月23日 上午6:28
答复

sricanth arroju

等级: Regular Member

帖子: 126

加入日期: 2009年10月2日

最近的帖子

Nagendra:

java.lang.NullPointerException
at com.liferay.portlet.expando.service.impl.ExpandoValueLocalServiceImpl.addValue(ExpandoVal
ueLocalServiceImpl.java:372)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307
)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMe
thodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvo
cation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInte
rceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvo
cation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationIn
terceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvo
cation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy98.addValue(Unknown Source)
at com.liferay.portlet.expando.service.ExpandoValueLocalServiceUtil.addValue(ExpandoValueLoc
alServiceUtil.java:232)
at com.liferay.portal.service.impl.UserLocalServiceImpl.addUser(UserLocalServiceImpl.java:36
9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307
)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMe
thodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvo
cation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInte
rceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvo
cation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationIn
terceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvo
cation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy70.addUser(Unknown Source)
at com.liferay.portal.service.UserLocalServiceUtil.addUser(UserLocalServiceUtil.java:149)
at com.liferay.portal.security.ldap.PortalLDAPUtil.importLDAPUser(PortalLDAPUtil.java:954)
at com.liferay.portal.security.ldap.PortalLDAPUtil.importFromLDAP(PortalLDAPUtil.java:582)
at com.liferay.portal.security.ldap.PortalLDAPUtil.importFromLDAP(PortalLDAPUtil.java:551)
at com.liferay.portlet.admin.job.LDAPImportJob.execute(LDAPImportJob.java:62)
at com.liferay.portal.job.JobWrapper.execute(JobWrapper.java:69)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)


.



its displaying the same error after applying patch also

did anybody resolve this

please help me!

Thanks,
Srikanth A
Bhanu P Kondeti
RE: LDAP Mapping and Custom attributes
2010年1月26日 下午9:28
答复

Bhanu P Kondeti

等级: New Member

帖子: 6

加入日期: 2009年8月5日

最近的帖子

Hi Narendra,
Were you able to achieve this. I need to do the similar thing in my project. I need to import the contact information and the address information of the user from the LDAP.

Could you please share your learnings with me.

Thanks,
Bhanu
vikash kumar chaurasia
RE: LDAP Mapping and Custom attributes
2010年2月24日 下午8:24
答复

vikash kumar chaurasia

等级: Junior Member

帖子: 97

加入日期: 2010年1月8日

最近的帖子

Hi,


My question is:

If I have created a custom attribute for User e.g. country from the control panel and set it's value as "France" for a user. How can I get that attribute value for that user in a portlet in Plugin SDK envt.

Thanks.
Bruno Vernay
RE: LDAP Mapping and Custom attributes
2010年10月20日 上午5:46
答复

Bruno Vernay

等级: Junior Member

帖子: 36

加入日期: 2010年4月6日

最近的帖子

Isn't it the point of the following parameter in portal-ext.properties

#
# When importing and exporting users, the portal will use this mapping to
# connect LDAP user attributes and portal contact attributes.
#
# See com.liferay.portal.model.ContactModel for a list of attributes.
#
ldap.contact.mappings=


I found the ContactModel JavaDoc here:
http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portal/model/ContactModel.html

I tried a few mappings like
ldap.contact.mappings=smsSn=pager\nskypeSn=homePhone

But without success !?