Revision 59236
Added by Konstantinos Triantafyllou about 4 years ago
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/utils/AuthoritiesService.java | ||
---|---|---|
7 | 7 |
|
8 | 8 |
public final String SUPER_ADMIN = "SUPER_ADMINISTRATOR"; |
9 | 9 |
public final String PORTAL_ADMIN = "PORTAL_ADMINISTRATOR"; |
10 |
public final String USER_ADMIN = "USER_ADMINISTRATOR";
|
|
10 |
public final String USER_ADMIN = "USER_MANAGER";
|
|
11 | 11 |
|
12 | 12 |
/** |
13 | 13 |
* Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT |
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/api/Test3Service.java | ||
---|---|---|
77 | 77 |
@Produces(MediaType.APPLICATION_JSON) |
78 | 78 |
public Response getToken(@QueryParam("accessToken") String accessToken){ |
79 | 79 |
logger.debug("Refresh token " + accessToken); |
80 |
System.out.printf("HELLO PAPAGENA"); |
|
81 | 80 |
CloseableHttpClient httpclient = HttpClients.createDefault(); |
82 | 81 |
HttpPost httppost = new HttpPost(issuer+"/token"); |
83 | 82 |
|
... | ... | |
92 | 91 |
httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); |
93 | 92 |
//Execute and get the response. |
94 | 93 |
HttpResponse response = null; |
95 |
|
|
96 | 94 |
response = httpclient.execute(httppost); |
97 |
|
|
98 | 95 |
org.apache.http.HttpEntity entity = response.getEntity(); |
99 |
|
|
100 |
logger.debug("I am here"); |
|
101 | 96 |
if (entity != null) { |
102 | 97 |
try (InputStream instream = entity.getContent()) { |
103 | 98 |
logger.debug(IOUtils.toString(instream, StandardCharsets.UTF_8.name())); |
... | ... | |
111 | 106 |
logger.error(e); |
112 | 107 |
} |
113 | 108 |
|
114 |
logger.info("DDDDDDDD"); |
|
115 |
|
|
116 | 109 |
return Response.status(200).type(MediaType.APPLICATION_JSON).build(); |
117 | 110 |
} |
118 | 111 |
|
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/api/RegistryService.java | ||
---|---|---|
212 | 212 |
@Path("/{type}/{id}/subscribers") |
213 | 213 |
@GET |
214 | 214 |
@Produces(MediaType.APPLICATION_JSON) |
215 |
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," + |
|
216 |
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))") |
|
215 |
/* @PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
|
|
216 |
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")*/
|
|
217 | 217 |
public Response getSubscribers(@PathParam("type") String type, @PathParam("id") String id) { |
218 | 218 |
Integer couId = calls.getCouId(type, id); |
219 | 219 |
JsonArray subscribers = calls.getUserNamesByCouId(couId, false); |
... | ... | |
227 | 227 |
@Path("/{type}/{id}/subscribers/email") |
228 | 228 |
@GET |
229 | 229 |
@Produces(MediaType.APPLICATION_JSON) |
230 |
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," + |
|
231 |
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))") |
|
230 |
/* @PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
|
|
231 |
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")*/
|
|
232 | 232 |
public Response getSubscribersEmail(@PathParam("type") String type, @PathParam("id") String id) { |
233 | 233 |
Integer couId = calls.getCouId(type, id); |
234 | 234 |
JsonArray subscribers = calls.getUserEmailByCouId(couId, false); |
... | ... | |
255 | 255 |
@Path("/{type}/{id}/managers") |
256 | 256 |
@GET |
257 | 257 |
@Produces(MediaType.APPLICATION_JSON) |
258 |
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," + |
|
259 |
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))") |
|
260 | 258 |
public Response getManagers(@PathParam("type") String type, @PathParam("id") String id) { |
261 | 259 |
Integer couId = calls.getCouId(type, id); |
262 | 260 |
JsonArray managers = calls.getUserNamesByCouId(couId, true); |
... | ... | |
270 | 268 |
@Path("/{type}/{id}/managers/email") |
271 | 269 |
@GET |
272 | 270 |
@Produces(MediaType.APPLICATION_JSON) |
273 |
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," + |
|
274 |
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))") |
|
275 | 271 |
public Response getManagersEmail(@PathParam("type") String type, @PathParam("id") String id) { |
276 | 272 |
Integer couId = calls.getCouId(type, id); |
277 | 273 |
JsonArray managers = calls.getUserEmailByCouId(couId, true); |
Also available in: Unified diff
[Users | Trunk]: Remove preautorize from get managers method