Foren

Define permissions API for Organization Role not working

thumbnail
Nilesh Gundecha, geändert vor 12 Jahren.

Define permissions API for Organization Role not working

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Define permissions API for Organization Role not working

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Any help would be highly appreciated!

Regards,
Nilesh
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: Define permissions API for Organization Role not working

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: Define permissions API for Organization Role not working

Junior Member Beiträge: 29 Beitrittsdatum: 25.01.13 Neueste Beiträge
Is there any solution found for this problem? I have the same problem. Can anyone help me please?

Thanks & Regards,
Surodip Patra