diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 2ff775f..08e4241 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,6 +4,9 @@ + + uses + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b517361 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,94 @@ + +# Changelog + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +[v3.7.0] [r4.23.0] - 2020-06-03 + +Fixes + +Bug #19415, Enhance Join VRE portlet performance when many VREs are present on a gateway and the user is logged in. + + +## [361] - [2018-11-09] + +Fixed minor glitch border 5px on the body + + + +## [350] - [2018-03-13] + +Feature #11434, Explore VREs use preloaders while loading VREs list + +Ported to GWT 2.8.2 + + + +## [350] - [2017-11-08] + +Added support for optional layout via TabPages and browsing VREs by Organisations and Category + + + +## [340] - [2017-07-05] + +Ported to GWT 2.8.1 + +Added support for Terms of Use Display + + + +## [330] - [2017-05-15] + +Ported to Java8 + +Added support for template emails + + + +## [320] - [2016-11-17] + +Removed ASL Session + +Implemented Feature #4877 remove VRE association to single Category constraint + +Info Button redircets to VRE Public page (if a public page exists for the VRE) + + + +## [310] - [2016-10-03] + +Added support for invite-only closed groups + +Fix for Bug #4877 Email Notification sent multiple times sometimes + +Logo VRE was not updated in the portlet due to liferay versioning of Document Library + + + +## [300] - [2016-03-28] + +Ported to Liferay 6.2 + + + +## [200] - [2015-10-22] + +Refactored to support virtual groups and related descriptions through LR Custom Field + +Refactored with GWT Bootstrap, new look and feel + +Added support for showing external hosted VREso, see Feature #755 + + + +## [110] - [2015-04-28] + +Redesigned and restyles the way vre description is shown to end users + + + +## [100] - [2015-03-02] + +First Release \ No newline at end of file diff --git a/pom.xml b/pom.xml index c049737..ffd67ac 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.gcube.portlets.user join-vre war - 3.7.0-SNAPSHOT + 3.7.0 gCube Join VRE Portlet Display the available VRE to Join @@ -93,7 +93,7 @@ org.gcube.core common-scope-maps - runtime + provided org.gcube.dvos diff --git a/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java b/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java index 33ca4d9..a433e37 100644 --- a/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java @@ -47,9 +47,11 @@ import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.model.Group; +import com.liferay.portal.model.MembershipRequest; import com.liferay.portal.model.VirtualHost; import com.liferay.portal.service.GroupLocalServiceUtil; import com.liferay.portal.service.LayoutSetLocalServiceUtil; +import com.liferay.portal.service.MembershipRequestLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.VirtualHostLocalServiceUtil; import com.liferay.portal.util.PortalUtil; @@ -200,7 +202,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService //first method called to get VREs and their categories @Override public LinkedHashMap> getVREs() { - + LinkedHashMap> toReturn = new LinkedHashMap>(); try { if (isWithinPortal()) { @@ -393,12 +395,15 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService List currUserGroups = new ArrayList(); GCubeUser currUser = pContext.getCurrentUser(getThreadLocalRequest()); + _log.debug("before currUserGroups"); if (currUser != null) { currUserGroups = groupsManager.listGroupsByUser(currUser.getUserId()); + _log.debug("currUserGroups size= "+currUserGroups.size()); } - + _log.debug("for each root sub organizations (VO): "); //for each root sub organizations (VO) for (GCubeGroup vOrg : rootGroupVO.getChildren()) { + _log.debug("vOrg: "+vOrg.getGroupName()); for (GCubeGroup vreSite : vOrg.getChildren()) { long vreID = vreSite.getGroupId(); String vreName = vreSite.getGroupName(); @@ -408,6 +413,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService String vreLogoURL = groupsManager.getGroupLogoURL(logoId); String groupName = groupsManager.getInfrastructureScope(vreSite.getGroupId()); String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreSite.getFriendlyURL(); + _log.debug("vreName: "+vreName); List vreGroups = groupsManager.getVirtualGroups(vreID); for (VirtualGroup vreGroup : vreGroups) { @@ -422,10 +428,11 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService } if (currUser != null) { //check if the user belongs to it + _log.debug("//check if the user belongs to = "+vreSite.getGroupName()); if (currUserGroups.contains(vreSite)) { toAdd.setUserBelonging(UserBelonging.BELONGING); } - else if (checkPending(currUser.getUsername(), vreSite.getGroupId())) + else if (checkPending(currUser.getUserId(), vreSite.getGroupId())) toAdd.setUserBelonging(UserBelonging.PENDING); } toUpdate.add(toAdd); @@ -529,7 +536,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService UserBelonging belongEnum = UserBelonging.NOT_BELONGING; if (gm.listGroupsByUser(currUser.getUserId()).contains(selectedVRE)) belongEnum = UserBelonging.BELONGING; - else if (checkPending(currUser.getUsername(), selectedVRE.getGroupId())) + else if (checkPending(currUser.getUserId(), selectedVRE.getGroupId())) belongEnum = UserBelonging.PENDING; //return the selected VRE for this user toReturn = new VRE(groupId, vreName, vreDescription, vreLogoURL, infraScope, friendlyURL, belongEnum, getVREMembershipType(selectedVRE.getMembershipType())); @@ -554,22 +561,13 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService return VreMembershipType.PRIVATE; } } - /** - * - * @param screenName - * @param groupId - * @return - * @throws UserRetrievalFault - * @throws GroupRetrievalFault - * @throws UserManagementSystemException - */ - private static boolean checkPending(String screenName, long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault { - UserManager um = new LiferayUserManager(); - List requests = um.listMembershipRequestsByGroup(groupId); - for (GCubeMembershipRequest r : requests) { - if ( r.getStatus() == MembershipRequestStatus.REQUEST && (r.getRequestingUser().getUsername().compareTo(screenName)==0)) - return true; - } + + private static boolean checkPending(long userId, long groupId) throws SystemException { + _log.debug("checkPending of userId "+userId + " to groupId="+groupId); + List lRequests = MembershipRequestLocalServiceUtil.getMembershipRequests(userId, groupId, 0); + if (lRequests != null && lRequests.size() > 0) + return true; + _log.debug("checkPending did not find request" + userId); return false; } @@ -583,7 +581,8 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService CacheRegistryUtil.clear(); long groupId = theVRE.getId(); _log.debug("Look if a request exists already"); - List userGroups = new LiferayGroupManager().listGroupsByUser(new LiferayUserManager().getUserId(username)); + long userId = new LiferayUserManager().getUserId(username); + List userGroups = new LiferayGroupManager().listGroupsByUser(userId); for (GCubeGroup g : userGroups) { if (g.getGroupId() == groupId) { _log.warn("User already belongs to " + scope + " SKIP addMembershipRequest"); @@ -591,7 +590,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService } } CacheRegistryUtil.clear(); - if (checkPending(username, groupId)) { + if (checkPending(userId, groupId)) { _log.warn("User already asked for " + scope + " REQUEST IS IN PENDING - SKIP addMembershipRequest"); return; }