Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Bharani Ravi Kanth
custom table insted of user_ table for Authentication?
April 2, 2012 3:04 AM
Answer

Bharani Ravi Kanth

Rank: Junior Member

Posts: 63

Join Date: January 19, 2012

Recent Posts

Hello Guys,

Since liferay uses default (users_)table to store the information of the user. is there any way to create a custom table where it stores user data and also authentication must also be done through this custom table.

Regards

Bharani
Sandip Patel
RE: custom table insted of user_ table for Authentication?
April 2, 2012 3:40 AM
Answer

Sandip Patel

Rank: Regular Member

Posts: 171

Join Date: January 4, 2011

Recent Posts

Hi Ravi,

Liferay use User_ table for store the information. Instead of create custom table, use custom field for User model.
Juhi Kumari
RE: custom table insted of user_ table for Authentication?
April 2, 2012 3:48 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi Bharani,
Why you want same copy of user table?? I don't think this is an easy task. You can extend user_ table with you custom field easily.
But don't replace user_ table.

Regards
Juhi
MICHAIL MOUDATSOS
RE: custom table insted of user_ table for Authentication?
April 2, 2012 4:49 AM
Answer

MICHAIL MOUDATSOS

Rank: Regular Member

Posts: 110

Join Date: October 4, 2011

Recent Posts

Bharani Ravi Kanth:
is there any way to create a custom table where it stores user data

I supppose ppl here are right when they say you must expand this table in order to use more fields for a user. However you can create an Entity of your own having the userId as one of their fields and its on your applications responsibility to populate these and how it will do it.

Bharani Ravi Kanth:
also authentication must also be done through this custom table.

I haven't try this but I think you should look at ## Authentication Pipeline section of the portal.properties file (look the descrption and the auth.pipeline.pre and auth.pipeline.post properties, which you can override in a hook (I think you actually/practically append classes by overriding it in a hook). Following the documented info, maybe you can affect the authentication process by examining the additional info you want to introduce to the User entity (either by extending the User_ table or by adding a table of your own) and manipulate the outcome of the validation process accordingly... (I suppose that all this should happen in the code of the class that implements the documented interface)

As I've already said, I haven't really tried this ever, so this is just a hunch, but according to the documentation, this sounds like a relevant property to deal with...

So I hope I helped a bit...
David H Nebinger
RE: custom table insted of user_ table for Authentication?
April 2, 2012 5:48 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7253

Join Date: September 1, 2006

Recent Posts

Bharani Ravi Kanth:
is there any way to create a custom table where it stores user data


You do not want to do this. Instead you should be looking at the custom fields (expando) to add whatever you need for the users. Makes the data available anywhere you need it (if you get the User object you have access to the expando bridge for accessing the custom fields), but most importantly it will not break all of the Liferay stuff that relies upon this table being properly populated.

authentication must also be done through this custom table.


You can write your own auth process to leverage the expando fields for the given user.
Tanaji Londhe
RE: custom table insted of user_ table for Authentication?
August 28, 2012 3:17 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Is it possible to remove some unnecessary fields from user_ or any other table (which is created automatically by Liferay)?
I heard that we can expand the table using liferay Expando concept.
MICHAIL MOUDATSOS
RE: custom table insted of user_ table for Authentication?
August 28, 2012 4:44 AM
Answer

MICHAIL MOUDATSOS

Rank: Regular Member

Posts: 110

Join Date: October 4, 2011

Recent Posts

Tanaji M. Londhe:
Is it possible to remove some unnecessary fields from user_ or any other table (which is created automatically by Liferay)?
I heard that we can expand the table using liferay Expando concept.


I don't think you can remove the fields because that would imply refactoring the related programmatic entity, which resides in Liferay code. (And I don't think you want to do that - i dont even know if it is possible at all through an -ext plugin. Of course it is possible if you tamper with the core code and rebuild emoticon ) The most common answer you 'd get is that if you dont need a field, just don't use it! That said, I'm waiting for others to see what they'd propose