Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Saurabh Gupta
How to make page login enable programatically
February 28, 2013 9:16 PM
Answer

Saurabh Gupta

Rank: New Member

Posts: 23

Join Date: September 24, 2012

Recent Posts

I am creating the pages and setting the portlet as above mentioned using this link
http://www.liferay.com/community/wiki/-/wiki/Main/Programmatically+Create+a+Layout+and+Place+a+Portlet+on+it#tjit_message_21886472
but i have 2 question, please if any body can help me out then it will really good.
1) When add a new page(Layout) programmatically, then how to make this login enable. means when user will click on link of that page, then if he is login can see the page and if he not login then login page will come to him and when he will login then he can see the page.
2) one more question that if owner of that page also can view the page he can not do Update or any thing else.
Thank you in advance
Samuel Kong
RE: How to make page login enable programatically
February 28, 2013 8:59 PM
Answer

Samuel Kong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1551

Join Date: March 10, 2008

Recent Posts

All you need to do is remove the VIEW permission for Guest users on the page that you are linking to. (not the new page you added programmatically). Liferay will automatically show the login page to guest users.
Saurabh Gupta
RE: How to make page login enable programatically
February 28, 2013 9:34 PM
Answer

Saurabh Gupta

Rank: New Member

Posts: 23

Join Date: September 24, 2012

Recent Posts

Samuel Kong:
All you need to do is remove the VIEW permission for Guest users on the page that you are linking to. (not the new page you added programmatically). Liferay will automatically show the login page to guest users.


Thanks for reply
I am adding 4 pages in one save operation and in this 1 page parent page and 3 are child page and parent will visible to everybody without login but when user will click on link of child page then it should we login enabled. if i will remove the VIEW permission for parent page then guest can't see the parent page also.
and how can remove the View permission for Guest programatically.
Jose Jimenez
RE: How to make page login enable programatically
February 28, 2013 9:46 PM
Answer

Jose Jimenez

LIFERAY STAFF

Rank: Regular Member

Posts: 151

Join Date: August 22, 2012

Recent Posts

Hi all!

Also, If you want to force the login of the user for view the pages you will define the pages as private pages in the site. Normally, public pages are pages that not logged users can view (guest user) and to view the private pages you need to be logged and to be member of the site. Normally the admin of the site is the person who adds members to this site when is a closed site, but you can configue the site as open and any user can be join to the site. A middle solution is to configure the site as restringed, in this case the user asks to be a member and then the admin allows or rejects him.

There, using private pages if you are not logged and request for a page, the portal redirects you to the login portet and when the login is successful the user will be redirected to the page if he has permission (member of this site).

For the second question, normally the owner of the page can do anything with te page, but is necessary to be logged into the portal. If you don't need that the users change the pages, you need to create all the site with a super-admin and the rest of the user will have a normal user-role with only view permissions.

I hope this information helps you,
Kind regards!!
Jose
Saurabh Gupta
RE: How to make page login enable programatically
March 4, 2013 4:15 AM
Answer

Saurabh Gupta

Rank: New Member

Posts: 23

Join Date: September 24, 2012

Recent Posts

Thank you for reply

But i want do all these thing programatically means setting all type of permission through code only. please can you tell me which API i need to call?