Don't know if this issue is solved?!

Generally it would be nice to post the solution (if found) too ...

So ...

Here is what worked out for me (myfaces + liferay 4.2.2):

in portlet.xml add:

<user-attribute>
     <name>user.name.given</name>
 </user-attribute>   
 <user-attribute>
     <name>user.name.family</name>
 </user-attribute>


retrieve name:

ExternalContext context=getContext();
    if(context==null) return "defaultName";
   
    Object requestObj=context.getRequest();
     
    if(requestObj instanceof PortletRequest) {       
        Map userInfo=(Map)
((PortletRequest)requestObj).getAttribute(PortletRequest.USER_INFO);
      
       String userName =
        (userInfo!=null) ? (String)
userInfo.get("user.name.given")+"_"+(String)
userInfo.get("user.name.family") : null;
}



Scott O'Bryan schrieb:
> You could....
>
> The answer to Kevin's issue may be retrieving the userPrincipal. 
> Anyone know if liferay provides this information in the userPrincipal?
>
> Kevin, a userPrincipal exposes the schema of the user to you.  But I'm
> not sure what liferay's user repository looks like.  You can generally
> retrieve information liferay knows about and if you need anything else
> then you'll have to use a mechanism like what David suggested or do
> some fancy configuration and enhancements of the user repository.
>
> Scott
>
> Nebinger, David wrote:
>>> Unfortunately I still can't get user information like name or email
>>> address.
>>> (String) userInfo.get("liferay.user.id") and
>>> PortletRequest.getRemoteUser() return a user id (here:
>>> liferay.com.1) but not the actual name of the user.
>>>     
>>
>> But if you have the key you can retrieve the information for yourself
>> from the database, right?
>>
>> I know it is not an elegant solution and, as you've indicated, might be
>> some sort of myfaces problem (I don't know, I'm using just myfaces &
>> liferay so I haven't seen the other parameters you're looking for), but
>> it might get you over the problem until the actual responsible party can
>> fix it...
>>
>>
>>   
>

Reply via email to