From ae173ccbd4cc715a82c80e9bb00f1247353bdaa2 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 23 Jun 2020 13:17:58 +0200 Subject: [PATCH] Adding the user to all supported organization instead of only to the organization the item is going to be published. --- .../java/org/gcube/gcat/persistence/ckan/CKANPackage.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java b/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java index 6c8e8ed..e25a7d0 100644 --- a/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java +++ b/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java @@ -175,6 +175,11 @@ public class CKANPackage extends CKAN { } + CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser(); + for(String supportedOrganization : supportedOrganizations) { + ckanUser.addUserToOrganization(supportedOrganization); + } + logger.debug("Supported CKAN Organization for current Context ({}) are {}", getCurrentContext(), supportedOrganizations); return supportedOrganizations; @@ -286,8 +291,7 @@ public class CKANPackage extends CKAN { objectNode.put(AUTHOR_KEY, ckanUser.getName()); objectNode.put(AUTHOR_EMAIL_KEY, ckanUser.getPortalUser().getEMail()); - CKANOrganization ckanOrganization = getPublishingOrganization(objectNode); - ckanUser.addUserToOrganization(ckanOrganization.getName()); + getPublishingOrganization(objectNode); return objectNode; }