Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Michele Zanarotti
copy encrypted passwords between different liferay installations.
September 25, 2013 7:06 AM
Answer

Michele Zanarotti

Rank: Junior Member

Posts: 84

Join Date: February 20, 2012

Recent Posts

Hello.
I recently had the task to export all users to a new liferay installation (from 6.0 to 6.1 GA3).
To test how to port passwords I created a user thorugh UI and copied the password_ field from the origin database through a sql update :

update User_ set password_ = '{original_encrypted_password}' where screenName = 'testUser';

This works as expected ! I'm able to enter and sign in to Liferay with the original password from the previous installation. I wanted to ask if this is the correct way to change the password (UI excluded). I'm doubtful about the field 'digest' in the User_ table. What's its meaning ?
I fear some drawbacks in this solution.
David H Nebinger
RE: copy encrypted passwords between different liferay installations.
September 25, 2013 7:57 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7153

Join Date: September 1, 2006

Recent Posts

you should never ever do things directly in the database.

Liferay has an export function to export users, just use the export/import process to handle what you're trying to do.
Michele Zanarotti
RE: copy encrypted passwords between different liferay installations.
September 25, 2013 11:07 AM
Answer

Michele Zanarotti

Rank: Junior Member

Posts: 84

Join Date: February 20, 2012

Recent Posts

Sorry, i didn't notice an export/import utility for users.

Can you point me in the right direction to do that ?

Thanks.
Manish Yadav
RE: copy encrypted passwords between different liferay installations.
September 26, 2013 6:38 AM
Answer

Manish Yadav

Rank: Expert

Posts: 384

Join Date: May 26, 2012

Recent Posts

Hi Michele Zanarotti,

You can export user in CSV file format from control panel User and Organisation .Copy below property in portal-ext.properties and add fields name which you want to extract.
users.export.csv.fields=fullName,emailAddress,password

Import Users is not available as OTB features in liferay. You can create Custom portlet which will take csv file as input and add users in your portal (Hint UserLocalServiceUtil.addUser() method.)

Please let me know if you require more input


Thanks & Regards
Manish Banwari lal Yadav
Michele Zanarotti
RE: copy encrypted passwords between different liferay installations.
September 26, 2013 9:12 AM
Answer

Michele Zanarotti

Rank: Junior Member

Posts: 84

Join Date: February 20, 2012

Recent Posts

I already proved to export users through the UI. I get an error that is well documented in these forums and in JIRA as a bug in the 6.0.

So exporting is not working. My only way is to re-create users , or read them from db, or make a portlet to do so. I can also make a new portlet for the destination server to import the exported users.

I need 2 portlets and i'm not going to create a portlet for a 6.0 version. I prefer to create that CSV starting from the Database. As you wrote, the essential fields are very simple to get.

My real problem is to know if that my method to transport passwords (as said in the first post) is correct.
Manish Yadav
RE: copy encrypted passwords between different liferay installations.
September 27, 2013 1:29 AM
Answer

Manish Yadav

Rank: Expert

Posts: 384

Join Date: May 26, 2012

Recent Posts

Hi Michele Zanarotti,

Yes you can import password as you mention in your first post and restart of server.
But its not recommended to update DB directly.


You can create two portlets 1 for Export users and roles into Xml file and 2 for Import Users into Databases

Thanks & Regards
Manish Yadav