added the option to send emails to users

This commit is contained in:
Antonis Lempesis 2020-07-30 11:49:24 +00:00
parent 2e9657cb61
commit 282b0b0d53
2 changed files with 3 additions and 3 deletions

View File

@ -170,7 +170,7 @@ public class RepositoryController {
public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype, public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
@RequestParam("repoId") String repoId, @RequestParam("repoId") String repoId,
@RequestParam("registeredBy") String registeredBy, @RequestParam("registeredBy") String registeredBy,
@RequestParam("comment") String comment, @RequestParam(value = "comment", required = false) String comment,
@RequestBody RepositoryInterface repositoryInterface) throws Exception { @RequestBody RepositoryInterface repositoryInterface) throws Exception {
return repositoryService.addRepositoryInterface(datatype, repoId, registeredBy, comment, repositoryInterface); return repositoryService.addRepositoryInterface(datatype, repoId, registeredBy, comment, repositoryInterface);
} }
@ -227,7 +227,7 @@ public class RepositoryController {
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repoId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repoId).registeredBy=='null') and hasRole('ROLE_USER'))") @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repoId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repoId).registeredBy=='null') and hasRole('ROLE_USER'))")
public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId, public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId,
@RequestParam("registeredBy") String registeredBy, @RequestParam("registeredBy") String registeredBy,
@RequestParam("comment") String comment, @RequestParam(value = "comment", required = false) String comment,
@RequestBody RepositoryInterface repositoryInterface) throws Exception { @RequestBody RepositoryInterface repositoryInterface) throws Exception {
return repositoryService.updateRepositoryInterface(repoId, registeredBy, comment, repositoryInterface); return repositoryService.updateRepositoryInterface(repoId, registeredBy, comment, repositoryInterface);
} }

View File

@ -295,7 +295,7 @@ public class EmailUtilsImpl implements EmailUtils {
try { try {
String subject = "OpenAIRE new interface registration request started for " + String subject = "OpenAIRE new interface registration request started for " +
repository.getDatasourceType() + "[" + repository.getEnglishName() + "]"; repository.getDatasourceType() + "[" + repository.getEnglishName() + "]";
String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" + String message = "Dear "+SecurityContextHolder.getContext().getAuthentication().getName()+",\n" +
"\n" + "\n" +
"We received a request to add the following interface: \n\n" + "We received a request to add the following interface: \n\n" +