Creating personal Private/Public sites for existing users

Jan Tošovský, modified 6 Years ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts
Dear All,
creating both Private/Public sites was disabled in my old 6.x portal:
layout.user.private.layouts.enabled=false
layout.user.private.layouts.auto.create=false
layout.user.public.layouts.enabled=false
layout.user.public.layouts.auto.create=false

After migrating to 7.2 I see this Private site is a must for displaying various personal menu entries (Notification, My Workflow items).
E.g. notification link points to https://www.server.com/user/j.doe/manage?p_p_id=com_liferay_notifications_web_portlet_NotificationsPortlet&p_p_lifecycle=0&p_p_auth=KCEpCwjH
but I am getting 'The requested resource could not be found.'
I've removed that layout.user.* settings from portal-ext.properties expecting these pages will be created automatically, but they don't.
How can I display notifications for these users?
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
com.liferay.portal.events.ServicePreAction has code to create the layouts, if they are missing, if the user is logged in as part of theme display initialization. It ends up calling _updateUserLayouts() and should create the layouts when they are missing.


Is the error backed by a stack trace that might indicate if this is failing before, during or after the ServicePreAction invoke?
Jan Tošovský, modified 6 Years ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts
<p>I was wrong. Inspecting the database I can see that <code>/manage</code> page is created successfully on the first request. Together with the view permissions for that user.</p>

<p>So there must be something else what is failing. There is no related stacktrace in the log.</p>

<p>I suspect it is somehow permissions related as admin can access the page without problems.</p>

<p>When altering that URL and providing my custom portlet as p_p_id parameter, it also works only for admin:</p>

<p><a href="http://localhost:8080/user/j.doe.1/manage?p_p_id=com_server_my_portlet">http://localhost:8080/user/j.doe.1/manage?p_p_id=com_server_my_portlet</a></p>

<p>So my users are missing permissions for dynamic injecting portlets. This led me to inspect <code>add-default-resource</code> portlet options. In the Notification portlet these default permissions are activated:</p>

<p><a href="https://github.com/liferay/liferay-portal/blob/7.2.0-ga1/modules/apps/notifications/notifications-web/src/main/java/com/liferay/notifications/web/internal/portlet/NotificationsPortlet.java">https://github.com/liferay/liferay-portal/blob/7.2.0-ga1/modules/apps/notifications/notifications-web/src/main/java/com/liferay/notifications/web/internal/portlet/NotificationsPortlet.java</a></p>

<p>com.liferay.portlet.add-default-resource=true</p>

<p>However, I couldn&#39;t find any configuration which actions to which audience should be created (as described e.g. here <a href="https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/adding-permissions-to-resources">https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/adding-permissions-to-resources</a> )</p>

<p>However, I can see few lines when executing this SQL over my DB:</p>

<p>select * from resourcepermission&nbsp; where name like &#39;%notification%&#39;;</p>

<p>I am quite puzzled now.</p>

<p>&nbsp;</p>

<p>&nbsp;</p>
Jan Tošovský, modified 6 Years ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts
I finally could locate the main problem:

While I can access My Profile on /web/j.doe, I am getting You do not have permission to view this page. error when visiting My Dashboard /user/j.doe.

When LR is started with empty database, it works properly. 

So there has to be some permission related issue in my migrated database.

I compared Group and Layout permissions for j.doe user, everything should be accessible, but it doesn't.
Jan Tošovský, modified 6 Years ago. Liferay Master Posts: 576 Join Date: 7/22/10 Recent Posts
Huh, I thought if j.doe has VIEW permissions for layout via OWNER role (and his userID matches ownerID), he can access the page. No, he can't. The OWNER role is ignored during these permission checks.

The key difference between migrated and new database was missing VIEW permission for /personal_site group for the USER role.

After modifying the database everything works fine now.