Bloggers recientes

Jamie Sammons

5 Mensajes
16 de agosto de 2016

Marcos Castro

6 Mensajes
16 de agosto de 2016

Ignacio Roncero Bazarra

2 Mensajes
15 de agosto de 2016

Javeed Chida

10 Mensajes
13 de agosto de 2016

Melanie Chung

4 Mensajes
12 de agosto de 2016

Angela Wu

15 Mensajes
4 de agosto de 2016

priti parmar

8 Mensajes
2 de agosto de 2016

Patrick Chung

1 Mensajes
25 de julio de 2016

Bryan Cheung

35 Mensajes
18 de julio de 2016

David H Nebinger

24 Mensajes
13 de julio de 2016

Rendering a portlet with different layout context of current page

General Blogs 1 de junio de 2009 Por Allen Chiang

Why I want to render portlet(s) from different page context?

A user can belong to multiple organizations and communities. Each organization or community has its public and private pages which holding set of portlets. Those portlets was acting in the context of current organization or community. The idea is to enable a portlet mirrored into a specified page so a user can aggregate portlets from different pages into one page and each portlet acts just like in its original page. For example, a user has joined 10 communities and each of those community has its own messageboard portlet. The user might create a private page for holding all messageboard portlets from 10 communities into it, so he/she can participate the discussion with all communities without going to each community one by one.

How does the portlet work in different page ?

Organization, Sub-Organization and Communities are the mechanism for grouping users. Although them are structured in kind of hierarchical, pages holding in each node are exclusive to others. A user can only be at one of the node in term of scope for the data of applications running on the node. There was a variable "scopeGroupId" heavily used in the system but not a only variable used by application to distinguish current context. Mixing of themeDisplay, portletDisplay and plid (PageLayout, I guessed) are also used for getting data, such as portlet preference, permission.


How to make portlets from different node co-exist in one page ?

When a portlet was added into a page, the portlet id was add into "typeSetting" of a layout.
Here is the value of "typeSetting" for guest home page


Or friends page of social networking sample users.

column-1=121,6_WAR_wolportlet layout-template-id=2_columns_ii column-2=searchandinvite_WAR_searchandinviteportlet,4_WAR_wolportlet,


As you can see, there is only the portletId and the the Layout itself indicating which node the portlet is on.

If the portletId can be extended to including Layout information, and make it equivalent to the symbolic link of the unix file system for the real portlet on other page. When handling a portlet including render and processAction, if the portlet is a symbolic link, some of needed context will be stored in portlet object and used instead of current page context.

LR is adding the layoutId for getting the primary key of a portlet referring to resource and permission, so I am trying to use the same format for a portlet link from other page. Following is the example of two portlet symboliclink in a user's  private page. The page contains a blog portlet from "guest" community and a wiki portlet from community "developer".

The value of typeSettings of "myPage"

column-1=10839_LAYOUT_33, layout-template-id=2_columns_ii column-2=10907_LAYOUT_36,

How to limit search result based on the user's permission

General Blogs 3 de noviembre de 2008 Por Allen Chiang

Updated on 11/4/2008

Liferay has role based access control on any item created by different portlet, but the search result doesn't honor the permission but returned all matched item. Only till you clicked on the link then portlet indicated that you don't have permission to view it. In some cases, the summary of search result has already broken the permission if it gave the sensitive information.

If the search engine doesn't have the function of role base permission, we could mark up item with ACL prepared for indexing then do the same on the search query to match the user's permission.

There are few requirement for any given search engine to fullfil this idea.

  • The search engine must have boolean operation, for example: query1 AND query2
  • The search engine must have none tokenized field index and search capibility. For example:  field1 = "abc"
  • The search engine must have multiple value filed support for indexing , For example:  index field1 with values {"member", "guest"}


In Lifaray, the default Lucene search engine has all above requirement, so I could use my idea to implement the role base search.


The document for indexing has already used the "groupId" to restrict the result in the portlet, so we could use the "roleId" in the field for acl. To determine the values of "viewacl" will be using resourceId and permission service.

For example: (using json syntax)

a document with guest view permission prepared for indexing.

{doc:{portletId:"wiki", groupId:12345, viewacl: {"guest"}, ........}}

another document without guest view permission

{doc:{portletId:"wiki", groupId:12345, viewacl:{"10315", "10318"}, ........}}



The SearchEngineUtil will add extra field search of "viewacl" based on the user's role in current community, so the search api need to inculde a user object as an argument.

For example:

The query of search on "java"

+(+(+portletId:19) +(userName:java title:java content:java tagsEntries:java)) +(VIEWACL:guest)

The query fo a logined user.

+(+(+portletId:19) +(userName:java title:java content:java tagsEntries:java)) +(VIEWACL:guest VIEWACL:10315 VIEWACL:10130)



  • Only implemented in Messageboards portlet for the initial check in.
  • need to catch the action of portleconfiguration EditPermissionAction then reindex the item with new permission. current workaround is edit the message and save after the permission changed, it will reindex the document with new permission.
  • Only indexed with viewacl = groupId or guest. need to take care of all defined role permission. For example, an item with owner view permission only.
  • Need to implement the same for other applications.



Implementation of Q&A on Messageboards

General Blogs 31 de julio de 2008 Por Allen Chiang

The idea is to let a person who posted a messsage expecting answer to vote on comments as the solutions. Once those information built-up, we could use them for construct a FAQ.

The current implementation is using the MBMessageFlag table for the marker, because it was only used for marking the read status of a given message for users. This will not create needed step for upgrade.


The UI for setting a message as a question is added as part of edit page, so it was available only to users who have edit permission on the message.


Only the message creator will have the UI for marking the comments as answer


 The thread status changed to resolved after a cmment was marked as answer.

 The thread list view will show the status.

Mostrando 3 resultados.