3
votes

In Liferay when a page is added to the Site it by default gives VIEW permission to the Guest role.

Permission window for a Site Page

Is there any way (either through configuration or through hook or other) to disable this so that by default VIEW permission is disabled for Guest role when a new page is added to the Site?

2
Well, while page[Layout-in Liferay low level context] is added as Public page , Liferay assigns default guess permissions defined in sites.xml for Layout model. Basically there are two ways to avoid it through ext development.1.remove guest default permissions from sites.xml 2.change code in LayoutLocalServiceImpl in ext by over-riding addLayout method by having addGroupPermissions boolean value as false .Pankaj Kathiriya

2 Answers

5
votes

Well, while page [Layout-in Liferay low level context] is added as Public page, Liferay assigns default permissions to GUEST role defined in sites.xml for Layout model.

Basically there are two ways to avoid it through ext development:

  1. remove guest default permissions from sites.xml
  2. change code in LayoutLocalServiceImpl in ext by over-riding addLayout method by having addGroupPermissions boolean value as false.
5
votes

There are ways (through liferay Configuration and Ext) with which you can restrict VIEW of Site public pages for those Users who don't explicitly have that permission.

1st Approach

So this can be achieved by setting this property to false in portal-ext.properties:

permissions.check.guest.enabled=false

But by setting this property what will happen is that Guest role would make sense only for Users who have not logged-in, once the User logs-in even if there is a VIEW permission on Guest for a page or asset the User won't be able to view it unless the User has that permission.

So Guest role would be rendered completely useless even if you give all the permissions to Guest role.

For users who have not logged-in, you can send them to login page with some logic.

2nd approach

1) Updating site.xml in EXT-plugin to disable default VIEW permissions for guest while adding Site pages.

By doing so when site page is added, by default Guest role's view permission is unchecked.