Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Saikat Saha
save liferay generated userId in openldap as uid while creating new user
May 7, 2012 7:23 AM
Answer

Saikat Saha

Rank: New Member

Posts: 23

Join Date: November 16, 2011

Recent Posts

Hi all,

We are using LR 6.0.6 with OpenLDAP and OpenSSO. Also integrating another java application with LR.
We need to have the openLDAP uid as the Liferay generated userId. Currently getting the Liferay screenName as openLDAP uid.
Please help.
Amit Doshi
RE: save liferay generated userId in openldap as uid while creating new use
May 7, 2012 7:52 AM
Answer

Amit Doshi

Rank: Liferay Master

Posts: 549

Join Date: December 29, 2010

Recent Posts

According to my knowledge in LDAP & Liferay . I don't suggest to do this because during Upgradation processs it will put you in trouble.
UserID will keep on changing on the Liferay Version or even with Different Liferay Instance also because it is autogenerated.

Even then also you need to change then you need to modify PortalLDAPImporterImpl.java class for import.

Lets wait for some expert's Opinion.
David H Nebinger
RE: save liferay generated userId in openldap as uid while creating new use
May 7, 2012 7:54 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11511

Join Date: September 1, 2006

Recent Posts

Saikat Saha:
Hi all,

We are using LR 6.0.6 with OpenLDAP and OpenSSO. Also integrating another java application with LR.
We need to have the openLDAP uid as the Liferay generated userId. Currently getting the Liferay screenName as openLDAP uid.
Please help.


UserID is a surrogate key and therefore should not be used in any manner.
Saikat Saha
RE: save liferay generated userId in openldap as uid while creating new use
May 7, 2012 11:19 AM
Answer

Saikat Saha

Rank: New Member

Posts: 23

Join Date: November 16, 2011

Recent Posts

David H Nebinger:
Saikat Saha:
Hi all,

We are using LR 6.0.6 with OpenLDAP and OpenSSO. Also integrating another java application with LR.
We need to have the openLDAP uid as the Liferay generated userId. Currently getting the Liferay screenName as openLDAP uid.
Please help.


UserID is a surrogate key and therefore should not be used in any manner.



I need to check the role of the user logged in through LR from another (partner) application using open SSO. I tried to get the uid (LR userId) from cookie sent by the SSO and then by making queries from LR tables, I got the role. But the present problem is that, LR is sending the screenName to LDAP in uid field.

So can you suggest me any alternatives to do so. Thanks for your input.
Sujay Kumar Paul
RE: save liferay generated userId in openldap as uid while creating new use
May 7, 2012 10:54 PM
Answer

Sujay Kumar Paul

Rank: Regular Member

Posts: 165

Join Date: October 28, 2011

Recent Posts

I have faced the problem
I used the code for user id
here i am getting "test14" as user id it should be 14141 according to my db.

Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements())
{
String headerName = (String) headerNames.nextElement();

if (headerName.equals("UserId"))
{
Enumeration values = request.getHeaders(headerName);
if (values.hasMoreElements())
{
userId = (String) values.nextElement();
System.out.println("User Id is:::::::::::::" + userId);
}
}
else if (headerName.equals("CommonName"))
{

Enumeration values = request.getHeaders(headerName);
if (values.hasMoreElements())
{
commonName = (String) values.nextElement();
}
}
else if (headerName.equals("accept-language"))
{
Enumeration values = request.getHeaders(headerName);
if (values.hasMoreElements())
{
lang = (String) values.nextElement();
}
}
}



please give me the soution.

thanks
Sujay Kumar Paul
RE: save liferay generated userId in openldap as uid while creating new use
May 8, 2012 6:58 AM
Answer

Sujay Kumar Paul

Rank: Regular Member

Posts: 165

Join Date: October 28, 2011

Recent Posts

I think there is no other solution.

In my code userId fetching the screen name

I used this name to get user id from user_ table
David H Nebinger
RE: save liferay generated userId in openldap as uid while creating new use
May 8, 2012 9:30 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11511

Join Date: September 1, 2006

Recent Posts

You should not be hitting the user_ table at all.

You should be using the Liferay API to retrieve the User pojo by screen name.

Never go to the database directly.
Sujay Kumar Paul
RE: save liferay generated userId in openldap as uid while creating new use
May 9, 2012 3:11 AM
Answer

Sujay Kumar Paul

Rank: Regular Member

Posts: 165

Join Date: October 28, 2011

Recent Posts

thanks

can u give any documentation/ link on it