Fix critical issue with public datasets

This commit is contained in:
George Kalampokis 2021-11-25 16:45:29 +02:00
parent aed23a655b
commit 19aa2bd411
3 changed files with 5 additions and 5 deletions

View File

@ -313,7 +313,7 @@ public class DashBoardManager {
roles.add(UserDMP.UserDMPRoles.USER.getValue());
roles.add(UserDMP.UserDMPRoles.OWNER.getValue());
dmpList = dataManagementPlanRepository.getAuthenticated(dmpList, principal.getId(), roles);
datasetList = datasetRepository.getAuthenticated(datasetList, user, roles);
datasetList = datasetRepository.getAuthenticated(datasetList, user, roles).distinct();
}
@ -335,7 +335,6 @@ public class DashBoardManager {
List<RecentActivityModel> recentDatasetModels = datasetList
.withHint(HintedModelFactory.getHint(DatasetListingModel.class))
.distinct()
.select(item -> new RecentDatasetModel().fromEntity(item));
recentActivityModels.addAll(recentDatasetModels);
}/*);*/

View File

@ -186,6 +186,7 @@ public class DataManagementPlanManager {
DatasetCriteria datasetCriteria = new DatasetCriteria();
datasetCriteria.setDmpIds(Collections.singletonList(dmp.getId()));
datasetCriteria.setAllVersions(false);
datasetCriteria.setIsPublic(dataManagementPlanTableRequest.getCriteria().getIsPublic());
dmp.setDataset(retrieveRelevantDatasets(datasetCriteria, principalID));

View File

@ -192,7 +192,7 @@ public class DatasetManager {
if (datasetTableRequest.getCriteria().getRole() != null) {
roles.add(datasetTableRequest.getCriteria().getRole());
}
authItems = databaseRepository.getDatasetDao().getAuthenticated(items, userInfo, roles);
authItems = databaseRepository.getDatasetDao().getAuthenticated(items, userInfo, roles).distinct();
pagedItems = PaginationManager.applyPaging(authItems, datasetTableRequest);
} else {
if (principal.getId() != null && datasetTableRequest.getCriteria().getRole() != null) {
@ -210,9 +210,9 @@ public class DatasetManager {
DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
dataTable.setData(pagedItems.distinct().select(this::mapModel).stream().filter(Objects::nonNull).collect(Collectors.toList()));
dataTable.setData(pagedItems.select(this::mapModel).stream().filter(Objects::nonNull).collect(Collectors.toList()));
dataTable.setTotalCount(authItems.distinct().count());
dataTable.setTotalCount(authItems.count());
//CompletableFuture.allOf(itemsFuture, countFuture).join();
return dataTable;