From 5ae34426bec6263280880e5b9ce37210119c08b1 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Tue, 22 Nov 2016 11:54:41 +0000 Subject: [PATCH] added log for user's current role git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@134518 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../grsf_publish_ws/services/GrsfPublisherFisheryService.java | 4 +++- .../grsf_publish_ws/services/GrsfPublisherStockService.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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 94dc5db..caa1a1b 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 @@ -125,7 +125,9 @@ public class GrsfPublisherFisheryService { // check the user has editor/admin role into the org String organization = HelperMethods.retrieveOrgNameFromScope(contextInWhichPublish); - if(!catalogue.getRoleOfUserInOrganization(username, organization, catalogue.getApiKeyFromUsername(username)).equalsIgnoreCase(RolesCkanGroupOrOrg.ADMIN.toString())){ + String role = catalogue.getRoleOfUserInOrganization(username, organization, catalogue.getApiKeyFromUsername(username)); + logger.info("***************************Role of the user " + username + " is " + role); + if(!role.equalsIgnoreCase(RolesCkanGroupOrOrg.ADMIN.toString())){ status = Status.FORBIDDEN; throw new Exception("You are not authorized to create a product. Please check you have the Catalogue-admin role!"); diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java index c6b13b5..830842e 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java @@ -122,7 +122,9 @@ public class GrsfPublisherStockService { // check the user has editor/admin role into the org String organization = HelperMethods.retrieveOrgNameFromScope(contextInWhichPublish); - if(!catalogue.getRoleOfUserInOrganization(username, organization, catalogue.getApiKeyFromUsername(username)).equalsIgnoreCase(RolesCkanGroupOrOrg.ADMIN.toString())){ + String role = catalogue.getRoleOfUserInOrganization(username, organization, catalogue.getApiKeyFromUsername(username)); + logger.info("***************************Role of the user " + username + " is " + role); + if(!role.equalsIgnoreCase(RolesCkanGroupOrOrg.ADMIN.toString())){ status = Status.FORBIDDEN; throw new Exception("You are not authorized to create a product. Please check you have the Catalogue-Administrator role!");