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
This commit is contained in:
Costantino Perciante 2016-06-29 10:39:37 +00:00
parent 27ab6ac956
commit f5fe2d0b1f
2 changed files with 12 additions and 9 deletions

View File

@ -7,6 +7,9 @@
<dependent-module archiveName="ckan-metadata-publisher-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-metadata-publisher-widget/ckan-metadata-publisher-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="ckan-util-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-util-library/ckan-util-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="gcube-ckan-datacatalog"/>
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>

View File

@ -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;
}
}