redirect user to production root catalogue if he is not logged in

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@130109 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-07 14:20:44 +00:00
parent bd30f11a71
commit 2b9db225fd
1 changed files with 7 additions and 8 deletions

View File

@ -55,7 +55,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
public final static String TEST_USER = "test.user";
public final static String TEST_SCOPE = "/gcube/devsec/devVRE";
public final static String PRODUCTION_SCOPE = "/gcube/devsec/devVRE";
public final static String PRODUCTION_SCOPE = "/d4science.research-infrastructures.eu";
public final static String TEST_MAIL = "test.user@test-com";
public final static String TEST_SEC_TOKEN = "4620e6d0-2313-4f48-9d54-eb3efd01a810";
@ -75,20 +75,19 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
// check into session
HttpSession httpSession = getThreadLocalRequest().getSession();
String currentScope = getASLSession(httpSession).getScope();
ASLSession aslSession = getASLSession(httpSession);
String currentScope = aslSession.getScope();
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
String user = aslSession.getUsername();
CKanUtils instance = null;
try{
if(user.equals(TEST_USER)){
//USE
logger.warn("User is "+TEST_USER +" are we out from portal?");
logger.warn("I'm using root scope "+PRODUCTION_SCOPE);
return new CKanUtilsImpl(PRODUCTION_SCOPE);
}
logger.debug("The ckan util object was null");
instance = new CKanUtilsImpl(currentScope);
instance = new CKanUtilsImpl(PRODUCTION_SCOPE);
}else
instance = new CKanUtilsImpl(currentScope);
}catch(Exception e){
logger.error("Unable to retrieve ckan utils", e);
}