« Volver a Using Liferay

Personal Community

This wiki page is dedicated to the Personal Community feature in Liferay Enterprise Portal. The Personal Community has evolved over the different versions of Liferay, but none as big a change as in version 5.1.

Other Names (aka)#

  • My Community
  • Private Community (not to be confused with private pages)
  • Set of Personal Pages
  • Personal Zone

What is Personal Community?#

Pre 5.1#

A dynamic feature of Liferay portal is the Personal Community, where specified users can have a set of public and private pages for themselves to manage. Historically, you could give a Personal Community to a user by assigning them the Power User role. The maximum number of members to one Personal Community is one. A user with a Personal Zone cannot make anyone else a member of his community. If you own a Personal Community, you have administrative rights over the pages within the community.

5.1#

5.1 takes the Power User role and throws it out the window. By default, the Personal Community is a portal wide setting, so the setting will affect all users. Coincidentally, a the settings are divided between private and public pages for greater versatility. Here are the settings in portal.properties:

layout.user.private.layouts.enabled=true   //activate Personal Community with *private* pages 
layout.user.public.layouts.enabled=false   //deactivate Personal Community with *public* pages 

Customizations to Personal Community Pages#

One of the most asked questions about Personal Communities is how to administrate or manage the pages that belong to other users. How does one overcome the challenge that you cannot update something in Liferay that you don't have permissions to? How do you give a user a Personal Community that you have prepackaged with a set of predefined portlets and pages?

Pre 4.0#

If you search for "##Default User" in portal.properties, you will get the following:

    //defines the name of the first page
    default.user.layout.name=Home                                
   //define the default layout template by specifying the layout template ID
    default.user.layout.template.id=2_columns_ii                 
   //define which portlets go on which column of the page
    default.user.layout.column-1=71_INSTANCE_OY0d,82,23,61,65,   

The major drawbacks here are that you are limited to predefining one page and you don't have control over public pages.

4.x to 5.0.1#

Version 4.0 gave more flexibility in terms of private and public pages through the use of LARs (Liferay archives):

     //specify the LAR that will be used to autogenerate a Private Community's private
     default.user.private.layouts.lar=${resource.repositories.root}/deploy/default_user_private.lar        
    //and public pages.
    default.user.public.layouts.lar=${resource.repositories.root}/deploy/default_user_public.lar     

5.1#

Version 5.1 introduces a whole slew of new settings. Once again some portal wide settings from the past are now multiplied in two between private and public pages for a personal community. To save space, I'm just going to paste the private page settings here:

    //specify the default theme (used to be a portal wide setting)
    default.user.private.layout.regular.theme.id=classic    
    //speficy default color scheme
    default.user.private.layout.regular.color.scheme.id=01 
    //define whether a user can update the page you set up for them
    layout.user.private.layouts.modifiable=true
   //pages are auto generated if true; if set to false, the user gets a Personal Community without predefined pages. 
   //he can create the pages himself.             
    layout.user.private.layouts.auto.create=true            

Scenarios and Settings (feel free to add your own combinations here)#

I want to give users a Personal Community, but I don't want to prebuild it for them. I want them to have the freedom to do it themselves.

    layout.user.private.layouts.enabled=true
    layout.user.private.layouts.modifiable=true
    layout.user.private.layouts.auto.create=false

I want to give users a Personal Community with predefined pages, but I don't want them to update the pages.

    layout.user.private.layouts.enabled=true
    layout.user.private.layouts.modifiable=false
    layout.user.private.layouts.auto.create=true

I want to start out my users with a Personal Community with some default portlets, but they should be able to change it however they want.

    layout.user.private.layouts.enabled=true
    layout.user.private.layouts.modifiable=true
    layout.user.private.layouts.auto.create=true

I only want Power Users to get a Personal Community in 5.1#

Let's say you don't want every user to get their own set of personal pages; you want to selectively give certain users this power. You would put your logic in ServicePreAction.java. Search for " Layouts" inside ServicePreAction. Notice how the portal checks if you are signed in first, if you are, it checks to see whether layout.user.private.layouts.enabled is true. If layout.user.private.layouts.enabled=true, then it executes addDefaultUserPrivateLayouts(). Let's try putting in some logic that will also check if the user has the Power User role:

if (signedIn) { if (PropsValues.LAYOUT_USER_PRIVATE_LAYOUTS_ENABLED && UserLocalServiceUtil.hasRoleUser(RoleLocalServiceUtil.getRole(companyId, "Power User").getRoleId(), user.getUserId())) { 

addDefaultUserPrivateLayouts(user); } else { deleteDefaultUserPrivateLayouts(user, companyId); }

if (PropsValues.LAYOUT_USER_PUBLIC_LAYOUTS_ENABLED) { addDefaultUserPublicLayouts(user); } else { deleteDefaultUserPublicLayouts(user); } } }}}

Also make sure to modify the logic for deleteDefaultUserPrivateLayouts() to be consistent with the portal's default behavior!

protected void deleteDefaultUserPrivateLayouts(User user, long companyId)
	throws PortalException, SystemException {
	if (!PropsValues.LAYOUT_USER_PRIVATE_LAYOUTS_ENABLED && user.hasPrivateLayouts() ||

               /* if user does not have Power User role, and has a Private Community with private pages, delete the private pages */

		!UserLocalServiceUtil.hasRoleUser(RoleLocalServiceUtil.getRole(companyId, "Power User").getRoleId(), user.getUserId()) && 
                                user.hasPrivateLayouts()*/) {

		Group userGroup = user.getGroup();

		LayoutLocalServiceUtil.deleteLayouts(userGroup.getGroupId(), true);
	}
}

Developer notes#

Remember to use this setting to overwrite or extend ServicePreAction:

 servlet.service.events.pre=com.liferay.portal.events.ServicePreAction 

Improvements#

Perhaps there could be a setting that will revert back to the old Power User logic.

Potential Upgrade Complications (please contribute to this area)#

Will the old Power User logic be broken when upgrading to 5.1? How will upgrading to 5.1 affect my system that depends on only Power Users getting a Personal Community?

0 archivos adjuntos
62844 Accesos
Promedio (1 Votar)
La valoración media es de 3.0 estrellas de 5.
Comentarios
Respuestas anidadas Autor Fecha
Hi, can i check if there is any improvement to... Aw SH 24 de noviembre de 2008 21:32
Hi, I am using Liferay 5.2.2 with tomcat5.5.... Anand Abhyankar 19 de mayo de 2009 23:59
You can create a "user group" and associate new... Nicolás Cavallo 27 de octubre de 2009 19:17
First off what is the rational behind getting... Owen Davies 8 de junio de 2009 7:24
Any update ? It looks like the situation in v6... Bruno Vernay 22 de septiembre de 2010 9:12
layout.user.private.layouts.modifiable is an... Bruno Vernay 23 de septiembre de 2010 7:01
I'm using liferay 6 and want to change all the... Sarah Giles 29 de septiembre de 2011 10:11

Hi, can i check if there is any improvement to this requirements so that "having presonal community only for power user" can be achieved without any changes to code ? I am not competent enough to change it by code level, unless a very detail step by step guide is available (e.g. setup development envionrmet, compile changes, etc..)
Publicado el día 24/11/08 21:32.
Hi,
I am using Liferay 5.2.2 with tomcat5.5.
How can I get multiple default public pages?
For example, I need Welome and Blog as two default public pages with some predefined portlets to any user who registers to the site.
How to do this? Can you give me step-by-step instructions for this?
Thanks in advance.
>> Anand
Publicado el día 19/05/09 23:59.
First off what is the rational behind getting rid of the default option of using Power User for managing personal pages. This seems the better option as it is customisable by administrators in Liferay rather than developers changing property files.

Secondly, with this feature removed, what is the difference between a normal User and a Power User
Publicado el día 8/06/09 7:24.
You can create a "user group" and associate new users to this group.
Then you should create a set of default private and public pages.
The users within this user group will have this pages as their own personal pages.
Hope this helps.

Cheers.
Publicado el día 27/10/09 19:17 en respuesta a anand abhyankar.
Any update ?
It looks like the situation in v6 is still the same.
Besides, there is still a misleading description on the power user role: "Power Users have their own public and private pages."

Should we fill a bug ?
Publicado el día 22/09/10 9:12 en respuesta a Owen Davies.
layout.user.private.layouts.modifiable is an all or nothing config parameter:
  • If layout.user.private.layouts.modifiable=false, even the administrator cannot modify his own private pages.
  • If it is true, any user can add/delete his public and private pages.


But finally, I found the information: layout.user.private.layouts.power.user.required
Make personal community setting for Power User configurable

It existed since 2008, it is just a naming (taxonomy) problem to find the information:


Still, it would be nice to have permission on “page creation”.

Regards
Bruno
Publicado el día 23/09/10 7:01.
I'm using liferay 6 and want to change all the users public and private pages to have the same content on it. Is there anyway without deleting the user can I delete all of the "my community" pages and re make them with the theme and layout I want?
Publicado el día 29/09/11 10:11.