Hey guys,
Thanks for this thread! I was able to get this to work for me, albeit with slightly different code.
Rudy - your code provided a good framework for me to start, but I wasn't able to get it to work with your code. Perhaps it's because I'm using Liferay 6.0.6 GA, but here's what I modified (just the updatePermissions method) I have:
1private void updatePermissions(BlogsEntry entry)
2 throws ModelListenerException {
3 try {
4 ResourcePermissionLocalServiceUtil.setResourcePermissions(
5 entry.getCompanyId(),
6 BlogsEntry.class.getName(),
7 ResourceConstants.SCOPE_INDIVIDUAL,
8 Long.toString(entry.getPrimaryKey()),
9 RoleLocalServiceUtil.getRole(entry.getCompanyId(),
10 RoleConstants.USER).getRoleId(), new String[] {
11 "ADD_DISCUSSION", "VIEW" });
12 } catch (Exception e) {
13 throw new ModelListenerException(e);
14 }
15 }
Hopefully, others will find this useful, too.
Please sign in to flag this as inappropriate.