Minor fixes

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129158 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-06-18 08:25:17 +00:00
parent 7d164c7566
commit 4490c079e5
1 changed files with 48 additions and 30 deletions

View File

@ -52,6 +52,21 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
private final static String TEST_SEC_TOKEN = "4620e6d0-2313-4f48-9d54-eb3efd01a810";
// private final static String TEST_SEC_TOKEN = "f539884c-8697-4ac0-9bbf-2f4d595281f5";
// ckan utils methods
private CKanUtilsImpl instance;
@Override
public void init(){
// retrieve ckan information
try{
String currentScope = ScopeProvider.instance.get();
instance = new CKanUtilsImpl(currentScope);
}catch(Exception e){
logger.error("Unable to retrieve ckan information");
}
}
/* (non-Javadoc)
* @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#getCKanConnector()
*/
@ -197,14 +212,17 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
// with this invocation, we check if the role is present in ckan and if it is not it will be added
new CKanUtilsImpl(currentScope).checkRole(username, groupName, correspondentRoleToCheck);
boolean res = instance.checkRole(username, groupName, correspondentRoleToCheck);
if(res)
return reMapRole(mainRole);
}catch(Exception e){
logger.error("Unable to retrieve the role information for this user. Returning member role", e);
}
logger.debug("Unable to check the role into ckan organization, returning MEMBER as role");
// return the base role
return CkanRole.MEMBER;
}