Change database in Liferay with losing any data - liferay

As of today, I am developing the liferay portal enhancements with default hsql database. I have implemented many features and created multiple sites and site templates with different roles and user.
1) Now I want to change the database from hsql database to PostgreSQL. Now how can I change the database with losing any data (sites, users, roles and site templates)?
2) I have a web application which is deployed another tomcat instance. Now I want to perform the liferay database transaction from the servlet. transactions means need to get the user details based on the emailId or ScreenName?
Can anyone please confirm that how can I do the above tasks and It will be very thankful If any one suggest some useful tutorials.procedure to do the same.

1.)
You can migrate your data via the Control Panel. Navigate to Server Administration, there is a tab: Data Migration. You provide the credentials of the new Database and hit submit. That's all.
2.)
I do not undstand your 2.nd Question to be honest.

To change your database from hsql to PostgreSQL the best options are either change the portal-ext.properties of you portal with:
#
# PostgreSQL Config
#
jdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.url=jdbc:postgresql://localhost:5432/***databasename***
jdbc.default.username=
jdbc.default.password=
or in you /tomcat/conf/context.xml you can define some like this:
<Resource auth="Container" driverClassName="org.postgresql.Driver" maxActive="20" name="jdbc/LiferayPool" password="" type="javax.sql.DataSource" url="jdbc:postgresql://localhost:5432/**database name**" username=""/>
For your second question I think that you can use the Liferay web services. You can see them in you portal relative url:
/api/jsonws

Related

Rest Web API shows records in localserver, but not in IIS

I am trying to use Rest web API , to retrieve data.
When i am building and executing it using localserver, it is displaying the data.
But, when i publish it and use IIS to access it does not show any data. and shows this
"This XML file does not appear to have any style information associated with it. The document tree is shown below."
i am already using the same API for the functions of fileupload and they are working. Its just the matter of database, whenever i have to access database,it showing me the error above(This error means that no data is fetched).
Can you please help me with it?
Thanks in advance
The common reason behind the issue is iis user does not have enough permission to access the database.
To resolve the issue you can assign the database domain user which has enigh access to the database to the application pool by following below steps:
1)Open iis manager
2)select your application pool -> advanced setting.
3)Under Process Model, click on the “Identity” value and select “Custom account”.
enter your domain user name(DOMAIN\USERNAME) and password which user has to access to the database and click ok to apply the changes.
after applying changes select the application pool and click on the “Recycle”.
If you still face an issue you could refer below link for how to configure application pool user in SQL server.
https://forums.iis.net/post/2159167.aspx

Liferay database access level (Site Level)?

I have a requirement that I need to restrict the liferay database in site level.
Let me first explain my scenario.
Admin is the one who will create the site and site admins.
Here admin user is the owner and sites are different clients.
Now each site will treat as a different client.
So the site admin have privileges to see only his site related data
in the data base but not others site data.
How can I handle this situation?
Do I need to use the multiple databases for multiple clients/sites?
How do I maintain the different database for different client? Any
suggestion please?
Note: I am not using Organizations, we are using only sites.
I hope I understand what you need. Based on my understanding, you can create separate instance for each client in liferay and use database sharding. Database sharding will allows you to have different db for each client.
HTH.
You can use GroupID to split the users to some groups: Group Admin and Group Normal User.
Not to use different database for diffirent client. Because 2 group have some same points.You need only one database for all of things you want to do.But you can customize it follow GroupID ^^
Good luck!

Oracle ADF Authorization and role-based pages

I would like to create an adf application , this web application will have different user roles like manager,normal user and admin .
First, I want to check users when they try to login into system by getting users info from database. I mean authorization should be provided by adf security from database Users table
Then according to this user's roles, specific web pages should be shown to logged users. Users should see only pages that its responsible pages.
I dont know how to do it, I need your guidance
Users and roles are Weblogic's concern (presuming you are using Weblogic), you may find a great example on how to load users and roles from the database here:
http://soadev.blogspot.co.uk/2010/04/sqlauthenticator-simply-best.html
For enabling security in an ADF application, I presume you have found already enough info, but just in case:
https://docs.oracle.com/middleware/1212/adf/ADFFD/adding_security.htm#ADFFD877

Liferay - Authentication without populating liferay db

Again, Do we have any possible solution that avoid populating liferay db with user information for authentication using extending methods/custom implementation/hooks/plugins/extensions?
Regards
Vishal G
There's no way to avoid creating a user in the Liferay database. You can though create a dummy user that all users use or a dummy user for every user depending on your needs
It is generally not desirable to share accounts as you cannot benefit from all functionality regarding groups, personalization, ... This is basically why one would install a portal.
To create users you can use Liferay's services.
If authorization is not your concern, it is possible to override the authenitaction mechanism with a variety of methods. THe authentication pipeline might be a good starting point.
http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/authentication-pipeline
Good luck!
You can create a Liferay Hook to Authenticate using your custimization.
override the following jsp page.
/html/portlet/login/login.jsp
Or you can create your own login portlet. No need to populate all users in db.
Just findUserById().
Dont forget to mention this change in portal-ext.properties file. You will need to specify custom Login portlet id.

Where can I find information on how to customize the user registration process of Liferay + Sun Web Space Portal

I need to quickly customize the user registration form of the liferay/web space portal? Have not found any direct information on this so would appreciate any tips.
There are several possibilities:
The source is available, so you might want to patch the existing process
The API is available (e.g. see this thread in the liferay forum), so you can batch-create users or implement your own registration portlet and just use the API. AFAIK you can even register users via a webservice interface.
You can batch-insert users into the database
If your existing user data is stored in LDAP, you can connect Liferay to the database.

Resources