RE: Problem with Guest users permissions in embed Web form Portlet

Elena Stefanova, modified 6 Years ago. Junior Member Posts: 42 Join Date: 8/24/15 Recent Posts
Hi, there!In one of my projects ( running on  liferay-ce-7.2-ga1 ) I need to embed the Web form Portlet into a web content template of a custom structure. Inside this template I need to switch between two types of existing forms based on a specific values of other fields set by content editors. So the idea is to embed the web form portlet and pass a specific formID as a conf parameter to the portlet. The embed code looks like that:

<#assign preferences = freeMarkerPortletPreferences.getPreferences( "formInstanceId", "XXXX" )  />
<@liferay_portlet["runtime"]
         portletName="com_liferay_dynamic_data_mapping_form_web_portlet_DDMFormPortlet"    
         defaultPreferences="${preferences}"
         instanceId="123"
 />


This code seems to work and I manage to see the embed portlet with the correct form, but I'm able to see this ok only if I am logged as Admin user. However, if I check it as a Guest user, then the form is blurred and I'm not able to do any action on it (click on a field or button inside it). Also I see the "Select form" link of the form portlet which should be invisible for guests in general.
Any idea what I'm doing wrong?

Regards,
Eli
thumbnail
Mohammed yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi, 
   I was able to reproduce the error you mentioned, this is due to Liferay.Session  value is getting null for ddm form when not logged in , where ddm form is embedded onto webcontent . Instead of embedding  may be u can render the form in custom portlet  https://liferay.dev/blogs/-/blogs/liferay-form-in-custom-module.
Elena Stefanova, modified 6 Years ago. Junior Member Posts: 42 Join Date: 8/24/15 Recent Posts
Hi Mohammed and thanks for the reply!

I will give a try with the solution that you propose. Thank you once again!

Regards,
​​​​​​​
Eli