[Users | Trunk]: Remove preautorize from get managers method

This commit is contained in:
Konstantinos Triantafyllou 2020-08-07 09:23:49 +00:00
parent e6b08fa12e
commit d909d6610a
3 changed files with 5 additions and 16 deletions

View File

@ -212,8 +212,8 @@ public class RegistryService {
@Path("/{type}/{id}/subscribers") @Path("/{type}/{id}/subscribers")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," + /* @PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))") "@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")*/
public Response getSubscribers(@PathParam("type") String type, @PathParam("id") String id) { public Response getSubscribers(@PathParam("type") String type, @PathParam("id") String id) {
Integer couId = calls.getCouId(type, id); Integer couId = calls.getCouId(type, id);
JsonArray subscribers = calls.getUserNamesByCouId(couId, false); JsonArray subscribers = calls.getUserNamesByCouId(couId, false);
@ -227,8 +227,8 @@ public class RegistryService {
@Path("/{type}/{id}/subscribers/email") @Path("/{type}/{id}/subscribers/email")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," + /* @PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))") "@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")*/
public Response getSubscribersEmail(@PathParam("type") String type, @PathParam("id") String id) { public Response getSubscribersEmail(@PathParam("type") String type, @PathParam("id") String id) {
Integer couId = calls.getCouId(type, id); Integer couId = calls.getCouId(type, id);
JsonArray subscribers = calls.getUserEmailByCouId(couId, false); JsonArray subscribers = calls.getUserEmailByCouId(couId, false);
@ -255,8 +255,6 @@ public class RegistryService {
@Path("/{type}/{id}/managers") @Path("/{type}/{id}/managers")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
public Response getManagers(@PathParam("type") String type, @PathParam("id") String id) { public Response getManagers(@PathParam("type") String type, @PathParam("id") String id) {
Integer couId = calls.getCouId(type, id); Integer couId = calls.getCouId(type, id);
JsonArray managers = calls.getUserNamesByCouId(couId, true); JsonArray managers = calls.getUserNamesByCouId(couId, true);
@ -270,8 +268,6 @@ public class RegistryService {
@Path("/{type}/{id}/managers/email") @Path("/{type}/{id}/managers/email")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
public Response getManagersEmail(@PathParam("type") String type, @PathParam("id") String id) { public Response getManagersEmail(@PathParam("type") String type, @PathParam("id") String id) {
Integer couId = calls.getCouId(type, id); Integer couId = calls.getCouId(type, id);
JsonArray managers = calls.getUserEmailByCouId(couId, true); JsonArray managers = calls.getUserEmailByCouId(couId, true);

View File

@ -77,7 +77,6 @@ public class Test3Service {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public Response getToken(@QueryParam("accessToken") String accessToken){ public Response getToken(@QueryParam("accessToken") String accessToken){
logger.debug("Refresh token " + accessToken); logger.debug("Refresh token " + accessToken);
System.out.printf("HELLO PAPAGENA");
CloseableHttpClient httpclient = HttpClients.createDefault(); CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new HttpPost(issuer+"/token"); HttpPost httppost = new HttpPost(issuer+"/token");
@ -92,12 +91,8 @@ public class Test3Service {
httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
//Execute and get the response. //Execute and get the response.
HttpResponse response = null; HttpResponse response = null;
response = httpclient.execute(httppost); response = httpclient.execute(httppost);
org.apache.http.HttpEntity entity = response.getEntity(); org.apache.http.HttpEntity entity = response.getEntity();
logger.debug("I am here");
if (entity != null) { if (entity != null) {
try (InputStream instream = entity.getContent()) { try (InputStream instream = entity.getContent()) {
logger.debug(IOUtils.toString(instream, StandardCharsets.UTF_8.name())); logger.debug(IOUtils.toString(instream, StandardCharsets.UTF_8.name()));
@ -111,8 +106,6 @@ public class Test3Service {
logger.error(e); logger.error(e);
} }
logger.info("DDDDDDDD");
return Response.status(200).type(MediaType.APPLICATION_JSON).build(); return Response.status(200).type(MediaType.APPLICATION_JSON).build();
} }

View File

@ -7,7 +7,7 @@ public class AuthoritiesService {
public final String SUPER_ADMIN = "SUPER_ADMINISTRATOR"; public final String SUPER_ADMIN = "SUPER_ADMINISTRATOR";
public final String PORTAL_ADMIN = "PORTAL_ADMINISTRATOR"; public final String PORTAL_ADMIN = "PORTAL_ADMINISTRATOR";
public final String USER_ADMIN = "USER_ADMINISTRATOR"; public final String USER_ADMIN = "USER_MANAGER";
/** /**
* Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT * Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT