Revision 52620
Added by Konstantina Galouni about 5 years ago
modules/uoa-claims-api/trunk/src/main/java/eu/dnetlib/openaire/rest/HelloWorldService.java | ||
---|---|---|
127 | 127 |
} |
128 | 128 |
|
129 | 129 |
UserInfo userInfo = authorization.getUserHandler().getUserInfo(token); |
130 |
if(authorization.isProjectCurator(userInfo)|| authorization.isClaimCurator(userInfo)) {
|
|
130 |
// if(authorization.isProjectCurator(userInfo)) {
|
|
131 | 131 |
String userMail = userInfo.getEmail(); |
132 | 132 |
|
133 | 133 |
int total = -1; |
... | ... | |
139 | 139 |
|
140 | 140 |
List<Claim> claims = null; |
141 | 141 |
try { |
142 |
String projectId = fetchProjectHandler.fetchProjectIdByToken(projectToken,userMail); |
|
142 |
String projectId = null; |
|
143 |
if(authorization.isProjectCurator(userInfo)) { |
|
144 |
projectId = fetchProjectHandler.fetchProjectIdByToken(projectToken); |
|
145 |
} else { |
|
146 |
projectId = fetchProjectHandler.fetchProjectIdByTokenAndEmail(projectToken, userMail); |
|
147 |
} |
|
148 |
//String projectId = fetchProjectHandler.fetchProjectIdByToken(projectToken,userMail); |
|
143 | 149 |
if(projectId == null){ |
144 | 150 |
return Response.status(Response.Status.FORBIDDEN).entity(compose403Message("Forbidden: You don't have permission to access")) |
145 | 151 |
.type(MediaType.APPLICATION_JSON) |
... | ... | |
161 | 167 |
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(compose500Message("Fail to fetch claims" + |
162 | 168 |
" for projects with token " + projectToken + ".", e)).type(MediaType.APPLICATION_JSON).build(); |
163 | 169 |
} |
164 |
} |
|
170 |
// }
|
|
165 | 171 |
|
166 |
return Response.status(Response.Status.FORBIDDEN).entity(compose403Message("Forbidden: You don't have permission to access")) |
|
167 |
.type(MediaType.APPLICATION_JSON) |
|
168 |
.build(); |
|
172 |
// return Response.status(Response.Status.FORBIDDEN).entity(compose403Message("Forbidden: You don't have permission to access"))
|
|
173 |
// .type(MediaType.APPLICATION_JSON)
|
|
174 |
// .build();
|
|
169 | 175 |
} |
170 | 176 |
@GET |
171 | 177 |
@Path("/contexts/{contextId}/claims") |
modules/uoa-claims-api/trunk/src/main/resources/eu/dnetlib/openaire/rest/springContext-claims-authorization.properties | ||
---|---|---|
1 | 1 |
|
2 |
services.claims.authorization.userInfoUrl = http://mpagasas.di.uoa.gr:8080/dnet-user-management-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=
|
|
2 |
services.claims.authorization.userInfoUrl = http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=
|
|
3 | 3 |
services.claims.authorization.originServer = .di.uoa.gr |
4 | 4 |
services.claims.authorization.registeredRoles = Super Administrator,Portal Administrator,Expert - Community,Expert - Funder,Curator - Claim,Curator - Project,Curator - Community,Curator - Institution,Author,Registered User,User Manager |
5 | 5 |
services.claims.authorization.claimCuratorRoles = Super Administrator,Curator - Claim,Portal Administrator |
Also available in: Unified diff
HelloWorldService.java: in method for path 'project/claims' return claims:
either if user's email is included in 'contact_person' field of 'project' table of postgres databaase
or if user has 'Curator - Project' role.