master #173
@ -80,9 +80,10 @@ public class ResearcherController {
|
||||
|
||||
Researcher researcher = researchesServ.getResearcherById(id);
|
||||
if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin}, token)
|
||||
|| researcher == researchesServ.getResearcherByUser(authServ.getUserFromToken(token)))
|
||||
&& researcher.getId() != researchesServ.getResearcherByUser(authServ.getUserFromToken(token)).getId())
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
|
||||
if (researcher == null) return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
researchesServ.modifyResearcherData(researcher,updates);
|
||||
|
@ -83,18 +83,9 @@ public class ResearchesService {
|
||||
case "title":
|
||||
research.setTitle((String) entry.getValue());
|
||||
break;
|
||||
case "date":
|
||||
research.setReleaseDate((Date) entry.getValue());
|
||||
break;
|
||||
case "paperType":
|
||||
research.setPaperType((PaperType) entry.getValue());
|
||||
break;
|
||||
case "PdfLocation":
|
||||
research.setPdfLocation((String) entry.getValue());
|
||||
break;
|
||||
case "bibtexLocation":
|
||||
research.setBibTexLocation((String) entry.getValue());
|
||||
break;
|
||||
case "language":
|
||||
research.setLanguage((String) entry.getValue());
|
||||
break;
|
||||
@ -104,6 +95,9 @@ public class ResearchesService {
|
||||
case "summary":
|
||||
research.setSummary((String) entry.getValue());
|
||||
break;
|
||||
case "access":
|
||||
research.setAccess(Access.valueOf((String) entry.getValue()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
articleRepo.save(research);
|
||||
@ -175,13 +169,16 @@ public class ResearchesService {
|
||||
for (Map.Entry<String, Object> entry : updates.entrySet()){
|
||||
switch (entry.getKey()){
|
||||
case "orcidId":
|
||||
researcher.setOrcidId((String) entry.getValue());
|
||||
if (entry.getValue() != null)
|
||||
researcher.setOrcidId((String) entry.getValue());
|
||||
break;
|
||||
case "domain":
|
||||
researcher.setDomain((String) entry.getValue());
|
||||
if (entry.getValue() != null)
|
||||
researcher.setDomain((String) entry.getValue());
|
||||
break;
|
||||
case "site":
|
||||
researcher.setSite((String) entry.getValue());
|
||||
if (entry.getValue() != null)
|
||||
researcher.setSite((String) entry.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user