Revision 60399
Added by Argiro Kokogiannaki about 3 years ago
modules/uoa-claims-api/trunk/src/main/java/eu/dnetlib/openaire/rest/ClaimsService.java | ||
---|---|---|
868 | 868 |
try { |
869 | 869 |
if(openaireId != null) { |
870 | 870 |
CommunityUtils communityInfo = this.emailSender.getCommunityUtils().getCommunityInfo(openaireId); |
871 |
if(communityInfo.getManagers().contains(userMail)) { |
|
871 |
if(communityInfo.getManagers().contains(userMail) || authorization.isCommunityCurator(userInfo)) {
|
|
872 | 872 |
|
873 | 873 |
Notification notification = null; |
874 | 874 |
logger.debug("About to fetch notification"); |
... | ... | |
983 | 983 |
continueProcedure = true; |
984 | 984 |
} else { |
985 | 985 |
CommunityUtils communityInfo = this.emailSender.getCommunityUtils().getCommunityInfo(openaireId); |
986 |
if(communityInfo.getManagers().contains(userMail)) { |
|
986 |
if(communityInfo.getManagers().contains(userMail) || authorization.isCommunityCurator(userInfo) ) {
|
|
987 | 987 |
continueProcedure = true; |
988 | 988 |
} |
989 | 989 |
} |
... | ... | |
1001 | 1001 |
notificationHandler.updateNotificationPreferences(openaireId, userMail, frequency, notify); |
1002 | 1002 |
} |
1003 | 1003 |
} else { |
1004 |
Response.status(Response.Status.FORBIDDEN).entity(compose403Message("Forbidden: You don't have permission to access. You are not registered.")) |
|
1004 |
return Response.status(Response.Status.FORBIDDEN).entity(compose403Message("Forbidden: You don't have permission to access. You are not registered."))
|
|
1005 | 1005 |
.type(MediaType.APPLICATION_JSON) |
1006 | 1006 |
.build(); |
1007 | 1007 |
} |
... | ... | |
1011 | 1011 |
" for user with e-mail " + userMail + ".", e)).type(MediaType.APPLICATION_JSON).build(); |
1012 | 1012 |
} |
1013 | 1013 |
|
1014 |
return Response.status(200).entity(compose204Message("Save or Update for notification successful")).type(MediaType.APPLICATION_JSON).build();
|
|
1014 |
return Response.status(200).entity(compose200Message("Save or Update for notification successful")).type(MediaType.APPLICATION_JSON).build();
|
|
1015 | 1015 |
} |
1016 | 1016 |
return Response.status(Response.Status.FORBIDDEN).entity(compose403Message("Forbidden: You don't have permission to access. You are not registered.")) |
1017 | 1017 |
.type(MediaType.APPLICATION_JSON) |
... | ... | |
1026 | 1026 |
return builder.toString(); |
1027 | 1027 |
} |
1028 | 1028 |
|
1029 |
private String compose200Message(String message){ |
|
1030 |
return " { \"status\" : \"success\", \"code\": \"200\", \"message\" : \" " + message +" \" }"; |
|
1031 |
} |
|
1032 |
|
|
1029 | 1033 |
private String compose204Message(String message) { |
1030 | 1034 |
return "{ \"status\" : \"error\", \"code\" : \"204\", \"message\" : \" " + message +" \" }"; |
1031 | 1035 |
} |
... | ... | |
1072 | 1076 |
"\"description\" : \""+ exception.getMessage() +"\" ," + "\"deletedIds\" : " + new Gson().toJson(deletedIds) +","+ "\"notFoundIds\" : " + new Gson().toJson(notFoundIds) + " }"; |
1073 | 1077 |
} |
1074 | 1078 |
|
1075 |
TODO check if needed |
|
1076 |
private String compose200Message(){ |
|
1077 |
return " { \"status\" : \"success\", \"code\": \"200\" }"; |
|
1078 |
} |
|
1079 | 1079 |
|
1080 |
|
|
1080 | 1081 |
TODO check if needed |
1081 | 1082 |
private String compose204Message(){ |
1082 | 1083 |
return " { \"status\" : \"success\", \"code\": \"204\" }"; |
Also available in: Unified diff
Claim Service:
Notifications:
- allow save/ get notifications for community curators
- add method to compose 200 response
- return 403 if user is not among the managers or the curators