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