use of com.liferay.portal.kernel.model.ResourcePermission in project liferay-db-setup-core by ableneo.
the class SetupPermissions method deleteAllPortletPermissions.
private static void deleteAllPortletPermissions(final ResourcePermissions.Resource resource) {
try {
long companyId = SetupConfigurationThreadLocal.getRunInCompanyId();
List<ResourcePermission> resourcePermissions = ResourcePermissionLocalServiceUtil.getResourcePermissions(companyId, resource.getResourceId(), ResourceConstants.SCOPE_COMPANY, String.valueOf(companyId));
for (ResourcePermission resourcePermission : resourcePermissions) {
ResourcePermissionLocalServiceUtil.deleteResourcePermission(resourcePermission);
}
} catch (SystemException e) {
LOG.error(String.format("could not delete permissions for resource :%1$s", resource.getResourceId()), e);
}
}
use of com.liferay.portal.kernel.model.ResourcePermission in project liferay-imex by jpdacunha.
the class ImportRolePermissionsServiceImpl method reinitAction.
private void reinitAction(Role role) throws SystemException {
long roleId = role.getRoleId();
List<ResourcePermission> liste = resourcePermissionLocalService.getRoleResourcePermissions(roleId);
for (ResourcePermission resourcePermission : liste) {
if (resourcePermission.getScope() != ResourceConstants.SCOPE_INDIVIDUAL) {
resourcePermissionLocalService.deleteResourcePermission(resourcePermission);
}
}
}
Aggregations