Set page permissions to role programmatically
In JSP, // getting list of all public pages List<Layout> pageList = LayoutLocalServiceUtil.getLayouts(themeDisplay.getScopeGroupId(), false); for(Layout pages : pageList){ <input type="checkbox" name='<portlet:namespace/>page' value="<%=pages.getPlid() %>" <%=checked%> /><%=pages.getName() %><%=pages.getPlid() %> } In Controller, String[] pages = ParamUtil.getParameterValues(request, "page"); for(String page : pages){ long plId = Long.parseLong(page); Layout layout = null; try { layout = LayoutLocalServiceUtil.getLayout(plId); } catch (SystemException e) { } ResourcePermissionServiceUtil.setIndividualResourcePermissions(themeDisplay.getScopeGroupId(), themeDisplay.getCompanyId(), Layout.class.getName(), String.valueOf(layout.getPrimaryKey()), role.getRoleId(), new String[] { ActionKeys.VIEW }); }