This commit is contained in:
Francesco Mangiacrapa 2021-03-02 15:09:52 +01:00
parent 2c69842452
commit bfd9e01841
2 changed files with 16 additions and 9 deletions

View File

@ -615,10 +615,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
/**
* The method tries to retrieve the scope related to the organization using the map first,
* if no match is found, it retrieves such information by using liferay.
*
* @param orgName the org name
* @return the scope from org name
* if no match is found, it retrieves such information by using liferay
*/
private String getScopeFromOrgName(String orgName){
@ -629,11 +626,16 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
String toReturn = null;
if(isWithinPortal()){
if(mapOrganizationScope.containsKey(orgName))
if(mapOrganizationScope.containsKey(orgName)) {
toReturn = mapOrganizationScope.get(orgName);
else{
}else{
try{
String evaluatedScope = GenericUtils.retrieveScopeFromOrganizationName(orgName);
//see #20801
if(evaluatedScope==null || evaluatedScope.isEmpty()) {
logger.warn("Scope detected for OrganizationName: "+orgName+" is null or empty, skipping filling 'mapOrganizationScope' and returning null");
return toReturn;
}
mapOrganizationScope.put(orgName, evaluatedScope);
toReturn = evaluatedScope;
}catch(Exception e){

View File

@ -52,13 +52,18 @@ public class GenericUtils {
GroupManager gm = new LiferayGroupManager();
List<GCubeGroup> groups = gm.listGroups();
for (GCubeGroup gCubeGroup : groups) {
if(gCubeGroup.getGroupName().equalsIgnoreCase(organizationName))
return gm.getInfrastructureScope(gCubeGroup.getGroupId());
if(gCubeGroup.getGroupName().equalsIgnoreCase(organizationName)) {
String theScope = gm.getInfrastructureScope(gCubeGroup.getGroupId());
logger.info("For organizationName: " + organizationName+" by using "+LiferayGroupManager.class.getSimpleName()+ " got the scope: "+theScope +", returning it");
return theScope;
}
}
logger.info("No scope detected for organizationName: " + organizationName +" by using "+LiferayGroupManager.class.getSimpleName());
return null;
}
/**
* First check to retrieve the token, else create it.
*