set creator in new/cloned/newVersioned dmp

This commit is contained in:
Bernaldo Mihasi 2023-03-30 11:44:50 +03:00
parent b6b7a2444c
commit 63c866d74f
1 changed files with 3 additions and 0 deletions

View File

@ -481,6 +481,7 @@ public class DataManagementPlanManager {
checkDmpValidationRules(newDmp);
}
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
newDmp.setCreator(user);
createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao());
createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao(), user);
@ -645,6 +646,7 @@ public class DataManagementPlanManager {
if (latestVersionDMP.get(0).getVersion().equals(oldDmp.getVersion())) {
DMP newDmp = dataManagementPlan.toDataModel();
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
newDmp.setCreator(user);
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);
@ -705,6 +707,7 @@ public class DataManagementPlanManager {
DMP newDmp = dataManagementPlan.toDataModel();
UserInfo user = apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserInfoBuilder.class).id(principal.getId()).build();
newDmp.setCreator(user);
createOrganisationsIfTheyDontExist(newDmp, databaseRepository.getOrganisationDao());
createResearchersIfTheyDontExist(newDmp, databaseRepository.getResearcherDao(), user);