Total Pageviews

Sunday, April 28, 2013

Creating Roles in Liferay with

Need of user role is a very common in live scenario. One way is quite easy, just sign in as administrator, go to control panel and add one. But there is a drawback of this approach. If you are working on staging environment, you have to create this role in production environment when the code is deployed there. It means this is database specific and it will not move to production when the build is deployed on the server.

Liferay has provided us a better solution for the same. We can create role by using certain properties in file. We have to add the following properties in our portal-ext properties file.
Just restart the box after adding them, and go to the Roles section in Control Panel, you will be able to see both the roles added there.

Now if we want to access these roles in our code programmatically because this is basic need of creating role. So it can be done as following:
For getting users we can use the following methods:
Some other properties of that you can work on are:
Hope this will be helpful.

Thursday, April 18, 2013

Liferay: Uploading User Portrait via Custom Portlet

The following code can be integreate with any MVC portlet extending MVCPortlet in controller class.

Controller class

Tuesday, April 2, 2013

Solution of Duplicate Submission issue of Form on Page Reload

Re submission of form on press of refresh button is an old issue is Liferay. The reason behind this issue is the parameters and action which are available in URL after the form submission.  Earlier some developers used to open some other JSP after completion of Action.

But its solution is a very easy, provided by liferay itself. We have to set the following value in a tag inside liferay-portlet.xml which is set  false by default.