sergiogonzalez/liferay-portal — pull request #84 by matethurzo (2012-01-16 15:48:46+00:00)
Title: LPS-23779

Hey Sergio,

This pull request fixes the default resources for site members in the message boards, document library and bookmarks portlets.

The way it works as I understood that for the default category the MBPermission will be called. The DLPermission and BookmarksPermission classes work in the similar way. These classes, for the default category the portal looks up the resourcepermission table with a class name like 'com.liferay.portlet.messageboards' and the group id as a primkey and the group id as the ownerid. The first problem was that the database didn't contain such record, for such records the table stored a 0 value as an ownerId. This fix will insert the appropriate records whenit comes to group permissions.
The second problem was the in the resource-action xmls the setup was not correctly according to this behavior so I've changed those too.

My previous idea for this fix affected the *Permission classes themselves, I put a checking code there to see if the permissions are ok, and if not then insert it to the table. Brian pushed that back, so I've decided to take a whole new approach so instead of checking for bad values, let's insert the correct values to the table so we won't need additional checking during the permission checking. What I've figured out based on the *Permission classes that for the group permissions the group id should be the owner id; and after all the portal will find the correct permissions, the other way it won't work. We have performed lots of testing to see if something is broken, it seemed that this fix works, although if you know some better place to put this code snippet please let me know.

Also if you think there is a third approuch we should take, or there is some problems with this fix, please let me know.

Máté