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

Checking permissions in a custom portlet


Permissions in Liferay are very flexible but very complex to understand. In this recipe, we will show you only the basic use of permissions, but we hope this tutorial will be a start-up to implement more complex permissions. Let's assume that our goal is extending the previous portlet to display a secret message only for the users who have a specific permission. This permission should be configurable in the portlet permissions.

Getting ready…

We assume that you have a ready-to-use Maven portlet generated from Maven archetypes. In Chapter 1, Installation and Basic Configuration, we described how to achieve this.

How to do it…

To achieve our goal, we have to define and add a specific permission to our portlet from the previous recipe. Next, we should register our list of permissions. At the end, we will use those permissions to display the secret area in our portlet. Perform these steps:

  1. Create the src/main/resources/resource-actions folder.

  2. Create a file...