Define permissions API for Organization Role not working

thumbnail
Nilesh Gundecha, modified 14 Years ago. Regular Member Posts: 205 Join Date: 12/1/09 Recent Posts
I am using Liferay 6.1 and I have written below code for defining permissions for custom roles



                Role role = RoleLocalServiceUtil.fetchRole(companyId, RoleType.ORGANIZATION_MANAGER);
                int scope = ResourceConstants.SCOPE_GROUP_TEMPLATE;
	        long roleId = role.getRoleId();
		long companyId = role.getCompanyId();
		String primKey = String.valueOf(companyId);
                String name = "com.liferay.portlet.blogs";
                String actionIds[] = new String[] {ActionKeys.ADD_ENTRY, ActionKeys.SUBSCRIBE};

		try{
			if (_PERMISSIONS_USER_CHECK_ALGORITHM == 6) {
				ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId, name, scope, primKey, roleId, actionIds);
			}
			else {
				PermissionLocalServiceUtil.setRolePermissions(roleId, companyId, name, scope, primKey, actionIds);
			}
		}catch(Exception e){
			e.printStackTrace();
		}


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
thumbnail
Nilesh Gundecha, modified 14 Years ago. Regular Member Posts: 205 Join Date: 12/1/09 Recent Posts
Any help would be highly appreciated!

Regards,
Nilesh
thumbnail
Hitoshi Ozawa, modified 13 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 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.
thumbnail
Surodip Patra, modified 13 Years ago. Junior Member Posts: 29 Join Date: 1/25/13 Recent Posts
Is there any solution found for this problem? I have the same problem. Can anyone help me please?

Thanks & Regards,
Surodip Patra