Foros de discusión

add page permission to role programmatically

robin thakur, modificado hace 7 años.

add page permission to role programmatically

Regular Member Mensajes: 146 Fecha de incorporación: 9/01/14 Mensajes recientes
Hi,

what we have to do if we want to add page access permission to particular role by using code and similarly remove page permission to role.
Please give some example and what all parameters are in ResourcePermissionLocalServiceUtil.addResourcePermission() method.

Thanks
Robin Thakur
thumbnail
Manish Yadav, modificado hace 7 años.

RE: add page permission to role programmatically

Expert Mensajes: 493 Fecha de incorporación: 26/05/12 Mensajes recientes
Try with below code


Role userRole = RoleLocalServiceUtil.getRole(companyId, "POWER USER");
ResourcePermissionServiceUtil.setIndividualResourcePermissions(themeDisplay.getScopeGroupId(),
themeDisplay.getCompanyId(), Layout.class.getName(), "primKey",
userRole.getRoleId(), new String[] { ActionKeys.VIEW });
robin thakur, modificado hace 7 años.

RE: add page permission to role programmatically

Regular Member Mensajes: 146 Fecha de incorporación: 9/01/14 Mensajes recientes
Hi Manish,

What is "primKey" here in the mentioned code.