diff --git a/.classpath b/.classpath index 514af2a..129b84c 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -19,7 +19,7 @@ - + @@ -29,10 +29,10 @@ - + - + - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 443e085..b257af7 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,6 +1,6 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error diff --git a/distro/changelog.xml b/distro/changelog.xml index 1495349..e6abcc0 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,8 @@ + + Minor improvements + Metadata model v.3 supported diff --git a/pom.xml b/pom.xml index bf60846..cb86d4f 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.gcube.portlets.gcubeckan gcube-ckan-datacatalog war - 1.5.0-SNAPSHOT + 1.5.1-SNAPSHOT gCube CKAN Data Catalog The gCube CKAN Data Catalog portlet diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java index 6f4ba7a..80d48d4 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java @@ -90,10 +90,16 @@ public class UserUtil { // retrieve the role for (GCubeGroup vre: listOfGroups) { - if(vre.getGroupId() == groupIdContext) + if(vre.getGroupId() == groupIdContext){ + String localRole = RolesCkanGroupOrOrg.convertToCkanCapacity(getLiferayHighestRoleInOrg(roleManager.listRolesByUserAndGroup(user.getUserId(), vre.getGroupId()))); mapRoleByGroupSingleVre.put(vre.getGroupName().toLowerCase(), - RolesCkanGroupOrOrg.convertToCkanCapacity(getLiferayHighestRoleInOrg(roleManager.listRolesByUserAndGroup(user.getUserId(), vre.getGroupId())))); - else + localRole); + // check if extra roles must be assigned + logger.debug("Checking if there is the need to extend role " + localRole + " for user " + user.getUsername() + " in other vres"); + instance.assignRolesOtherOrganization(user.getUsername(), + vre.getGroupName().toLowerCase(), + RolesCkanGroupOrOrg.convertFromCapacity(localRole)); + }else mapRoleByGroupExtrasVre.put(vre.getGroupName().toLowerCase(), RolesCkanGroupOrOrg.convertToCkanCapacity(getLiferayHighestRoleInOrg(roleManager.listRolesByUserAndGroup(user.getUserId(), vre.getGroupId())))); } @@ -102,7 +108,7 @@ public class UserUtil { if(mapRoleByGroupExtrasVre.size() > 0) new AddUserToOrganizationThread( instance, - userManager.getUserByEmail(userEMail).getUsername(), + user.getUsername(), mapRoleByGroupExtrasVre). start(); diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java index 8543cd7..b5b1837 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java @@ -40,8 +40,10 @@ public class AddUserToOrganizationThread extends Thread { logger.debug("Thread for role association started. Organizations and roles are in the map: " + orgAndCapacity); Set> entrySet = orgAndCapacity.entrySet(); for (Entry entry : entrySet) { - if(instance.getOrganizationByName(entry.getKey()) != null) + if(instance.getOrganizationByName(entry.getKey()) != null){ instance.checkRoleIntoOrganization(username, entry.getKey(), RolesCkanGroupOrOrg.convertFromCapacity(entry.getValue())); + instance.assignRolesOtherOrganization(username, entry.getKey(), RolesCkanGroupOrOrg.convertFromCapacity(entry.getValue())); + } else if(instance.getGroupByName(entry.getKey()) != null){ RolesCkanGroupOrOrg roleInGroup = RolesCkanGroupOrOrg.convertFromCapacity(entry.getValue()); roleInGroup = roleInGroup.equals(RolesCkanGroupOrOrg.EDITOR) ? RolesCkanGroupOrOrg.MEMBER : roleInGroup;