use of com.liferay.imex.role.model.PortletPermissions in project liferay-imex by jpdacunha.
the class ExportRolePermissionsServiceImpl method getRolePermissions.
private RolePermissions getRolePermissions(long companyId, long roleId, boolean allActions) throws Exception {
RolePermissions result = new RolePermissions();
List<Portlet> portlets = portletLocalService.getPortlets(companyId, true, false);
List<String> portletNames = new ArrayList<String>(portlets.size() + 1);
for (Portlet portlet : portlets) {
String portletName = portlet.getPortletId();
portletNames.add(portletName);
}
portletNames.add(PortletKeys.PORTAL);
for (String portletName : portletNames) {
PortletPermissions portletPermissions = new PortletPermissions();
List<String> modelResources = ResourceActionsUtil.getPortletModelResources(portletName);
for (String modelResource : modelResources) {
Resource r = getModelResource(companyId, roleId, modelResource, allActions);
if (allActions || r.getActionList().size() > 0) {
portletPermissions.getModelResourceList().add(r);
}
}
Resource pr = getPortletResource(companyId, roleId, portletName, allActions);
portletPermissions.setPortletResource(pr);
if (allActions || portletPermissions.getModelResourceList().size() > 0 || pr.getActionList().size() > 0) {
result.getPortletPermissionsList().add(portletPermissions);
}
}
return result;
}
Aggregations