From f5fe2d0b1fba8c476efd32a60558b9396ae2c1e1 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Wed, 29 Jun 2016 10:39:37 +0000 Subject: [PATCH] Fixed redirection after product creation git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129633 82a268e6-3cf1-43bd-a215-b396298e98cf --- .settings/org.eclipse.wst.common.component | 3 +++ .../GcubeCkanDataCatalogServiceImpl.java | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index d96692a..e448544 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -7,6 +7,9 @@ uses + + uses + diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java index 047d574..80e8c0e 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java @@ -20,7 +20,6 @@ import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.SessionManager; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.datacatalogue.ckanutillibrary.CKanUtilsImpl; -import org.gcube.datacatalogue.ckanutillibrary.models.CkanRolesIntoLiferay; import org.gcube.datacatalogue.ckanutillibrary.models.RolesIntoOrganization; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService; @@ -33,6 +32,7 @@ import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager; import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; import org.gcube.vomanagement.usermanagement.model.GCubeRole; +import org.gcube.vomanagement.usermanagement.model.GatewayRolesNames; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -284,19 +284,19 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem logger.debug("The list of roles for " + username + " into " + groupName + " is " + roles); // the default one - String mainRole = CkanRolesIntoLiferay.CATALOG_MEMBER; + String mainRole = "Catalogue-Member"; RolesIntoOrganization correspondentRoleToCheck = RolesIntoOrganization.MEMBER; // NOTE: it is supposed that there is just one role for this person correspondent to the one in the catalog for (GCubeRole role : roles) { logger.debug("User " + username + " has role " + role.getRoleName() + " in " + currentScope); - if(role.getRoleName().equalsIgnoreCase(CkanRolesIntoLiferay.CATALOG_ADMIN.toString())){ - mainRole = CkanRolesIntoLiferay.CATALOG_ADMIN; + if(role.getRoleName().equalsIgnoreCase(GatewayRolesNames.CATALOGUE_ADMIN.getRoleName())){ + mainRole = GatewayRolesNames.CATALOGUE_ADMIN.getRoleName(); correspondentRoleToCheck = RolesIntoOrganization.ADMIN; break; - }else if(role.getRoleName().equalsIgnoreCase(CkanRolesIntoLiferay.CATALOG_EDITOR.toString())){ - mainRole = CkanRolesIntoLiferay.CATALOG_EDITOR; + }else if(role.getRoleName().equalsIgnoreCase(GatewayRolesNames.CATALOGUE_EDITOR.getRoleName())){ + mainRole = GatewayRolesNames.CATALOGUE_EDITOR.getRoleName(); correspondentRoleToCheck = RolesIntoOrganization.EDITOR; break; } @@ -326,9 +326,9 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem */ private CkanRole reMapRole(String mainRole) { switch(mainRole){ - case CkanRolesIntoLiferay.CATALOG_ADMIN: return CkanRole.ADMIN; - case CkanRolesIntoLiferay.CATALOG_EDITOR: return CkanRole.EDITOR; - case CkanRolesIntoLiferay.CATALOG_MEMBER: return CkanRole.MEMBER; + case "Catalogue-Admin": return CkanRole.ADMIN; + case "Catalogue-Editor": return CkanRole.EDITOR; + case "Catalogue-Member": return CkanRole.MEMBER; default : return CkanRole.MEMBER; } }