diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 4ede96d..714351a 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,2 +1,5 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java index a46b977..80db2aa 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java @@ -61,13 +61,17 @@ public class GrsfPublisherFisheryService { // Logger private static final org.slf4j.Logger logger = LoggerFactory.getLogger(GrsfPublisherFisheryService.class); + /* @GET @Path("hello") @Produces(MediaType.TEXT_PLAIN) public Response hello() { return Response.ok("Hello.. Fishery service is here").build(); } + */ + /* + * Already Managed By gCat @GET @Path("get-licenses") @Produces(MediaType.APPLICATION_JSON) @@ -88,6 +92,7 @@ public class GrsfPublisherFisheryService { .build(); } } + */ @POST @Path("publish-product") @@ -120,6 +125,8 @@ public class GrsfPublisherFisheryService { String apiKey = catalogue.getApiKeyFromUsername(username); String organization = HelperMethods.retrieveOrgNameFromScope(context); + + CommonServiceUtils.hasAdminRole(username, catalogue, apiKey, organization); // extend this role to the other organizations in this context diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java index 5c46f86..eced8e5 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java @@ -697,9 +697,10 @@ public class CommonServiceUtils { * @return */ public static String evaluateOrganization(String organization, Sources sourceInPath) { - if(sourceInPath.equals(Sources.GRSF) && organization.equals(Constants.GRSF_ADMIN_ORGANIZATION_NAME)) + if(sourceInPath.equals(Sources.GRSF) && + (organization.compareTo(Constants.GRSF_ADMIN_ORGANIZATION_NAME)==0 || organization.compareTo(Constants.GRSF_PRE_ORGANIZATION_NAME)==0)){ return Constants.GRSF_ADMIN_ORGANIZATION_NAME; - else + }else return sourceInPath.getOrigName().toLowerCase(); } } \ No newline at end of file