留言板

add page permission to role programmatically

robin thakur,修改在7 年前。

add page permission to role programmatically

Regular Member 帖子: 146 加入日期: 14-1-9 最近的帖子
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,修改在7 年前。

RE: add page permission to role programmatically

Expert 帖子: 493 加入日期: 12-5-26 最近的帖子
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,修改在7 年前。

RE: add page permission to role programmatically

Regular Member 帖子: 146 加入日期: 14-1-9 最近的帖子
Hi Manish,

What is "primKey" here in the mentioned code.