Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nilesh Gundecha
Define permissions API for Organization Role not working
April 18, 2012 12:31 AM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 196

Join Date: November 30, 2009

Recent Posts

I am using Liferay 6.1 and I have written below code for defining permissions for custom roles

 1
 2
 3                Role role = RoleLocalServiceUtil.fetchRole(companyId, RoleType.ORGANIZATION_MANAGER);
 4                int scope = ResourceConstants.SCOPE_GROUP_TEMPLATE;
 5            long roleId = role.getRoleId();
 6        long companyId = role.getCompanyId();
 7        String primKey = String.valueOf(companyId);
 8                String name = "com.liferay.portlet.blogs";
 9                String actionIds[] = new String[] {ActionKeys.ADD_ENTRY, ActionKeys.SUBSCRIBE};
10
11        try{
12            if (_PERMISSIONS_USER_CHECK_ALGORITHM == 6) {
13                ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, name, scope, primKey, roleId, actionIds);
14            }
15            else {
16                PermissionLocalServiceUtil.setRolePermissions(roleId, companyId, name, scope, primKey, actionIds);
17            }
18        }catch(Exception e){
19            e.printStackTrace();
20        }


This code does not throw any exception and when I navigate to Control Panel ==> Role Admin section, it shows that check box selected for the required permissions. But in actual, the permissions are not assigned. When I click on SAVE from Control Panel, then the permissions are getting assigned and it reflects in the portlets.

What am I doing wrong here? Any help please?

Regards,
Nilesh
Nilesh Gundecha
RE: Define permissions API for Organization Role not working
April 19, 2012 4:03 AM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 196

Join Date: November 30, 2009

Recent Posts

Any help would be highly appreciated!

Regards,
Nilesh
Hitoshi Ozawa
RE: Define permissions API for Organization Role not working
July 21, 2012 6:52 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

I think you'll get better replies if you post your question to the 3. Development forum instead of this forum which is about liferay.com site here.
Surodip Patra
RE: Define permissions API for Organization Role not working
January 30, 2013 2:59 AM
Answer

Surodip Patra

Rank: Junior Member

Posts: 28

Join Date: January 25, 2013

Recent Posts

Is there any solution found for this problem? I have the same problem. Can anyone help me please?

Thanks & Regards,
Surodip Patra