掲示板

add page permission to role programmatically

7年前 に robin thakur によって更新されました。

add page permission to role programmatically

Regular Member 投稿: 146 参加年月日: 14/01/09 最新の投稿
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
7年前 に Manish Yadav によって更新されました。

RE: add page permission to role programmatically

Expert 投稿: 493 参加年月日: 12/05/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 });
7年前 に robin thakur によって更新されました。

RE: add page permission to role programmatically

Regular Member 投稿: 146 参加年月日: 14/01/09 最新の投稿
Hi Manish,

What is "primKey" here in the mentioned code.