Book Image

Liferay 6.x Portal Enterprise Intranets Cookbook

Book Image

Liferay 6.x Portal Enterprise Intranets Cookbook

Overview of this book

Table of Contents (19 chapters)
Liferay 6.x Portal Enterprise Intranets Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a role-dependent portlet


Liferay provides two ways to check permissions. The first mechanism implements the Java Portlet Specification 2.0 (JSR 286) and provides an XML definition to map a Liferay role and portlet role. The second mechanism uses the Liferay permission checker to verify users and the actions that they perform. In this recipe, we will show you how the Java Portlet Specification and Liferay work together.

Getting ready…

Generate or create an empty portlet using the Maven archetype generator. We described it in Chapter 1, Installation and Basic Configuration. It is not important which PortletBridge will be used. We will decide to use a simple one called MVCPortlet.

Let's assume that our goal is to write a greeting portlet that can recognize whether the current user is logged in as a user or a guest. In every situation, our portlet should display the greeting, Welcome Guest! or Welcome User.

How to do it…

Our concept is based on the approach that every kind of greeting will...