Bug fix for Bug #6237, Users added to VRE when loggedin could not enter the VRE unless they logout first
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/register-vre-users@141694 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fd22725f3d
commit
2b5bd8e3bc
|
@ -1,4 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-admin.register-vre-users.2-2-1"
|
||||
date="2017-01-22">
|
||||
<Change>Bug fix for Bug #6237, Users added to VRE when loggedin could not enter the VRE unless they logout first</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.register-vre-users.2-2-0"
|
||||
date="2016-12-02">
|
||||
<Change>Removed ASL Session</Change>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>register-vre-users</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<version>2.2.1-SNAPSHOT</version>
|
||||
<name>Register VRE Users</name>
|
||||
<description>
|
||||
Register VRE Users Portlet allow to select a user from the portal and add her to the VRE.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.portlets.admin.manageusers.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -139,7 +140,7 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Mana
|
|||
long currSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
||||
UserManager userM = new LiferayUserManager();
|
||||
List<GCubeUser> nonBelongingUsers = userM.listUsersByGroup(currSiteGroupId, false); //the users of i-marine or services etc
|
||||
nonBelongingUsers.removeAll(userM.listUsersByGroup(pContext.getCurrentGroupId(getThreadLocalRequest())));
|
||||
nonBelongingUsers.removeAll(userM.listUsersByGroup(pContext.getCurrentGroupId(getThreadLocalRequest()), false));
|
||||
|
||||
for (GCubeUser u : nonBelongingUsers) {
|
||||
String id = u.getUsername();
|
||||
|
@ -179,6 +180,7 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Mana
|
|||
}
|
||||
/**
|
||||
* register the user to the VRE and in the HL Group, plus send notifications to the users
|
||||
* it is needed to issue a fake membership request otherwise if the user is loggedIn it is not able to access the VRE unless she logout and login
|
||||
*/
|
||||
@Override
|
||||
public boolean registerUsers(List<PortalUserDTO> users2Register) {
|
||||
|
@ -186,8 +188,18 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Mana
|
|||
UserManager userM = new LiferayUserManager();
|
||||
for (PortalUserDTO user : users2Register) {
|
||||
try {
|
||||
GCubeUser currUser = userM.getUserByUsername(user.getId());
|
||||
_log.debug("registerUser " + currUser.getUsername() + " to groupId: "+ vreGroupId);
|
||||
userM.requestMembership(currUser.getUserId(), vreGroupId, "Automatic Request at " + new Date());
|
||||
_log.debug("fakeRequest sent");
|
||||
String replierUsername = LiferayUserManager.getAdmin().getScreenName();
|
||||
_log.trace("Sleep 1 second ...");
|
||||
Thread.sleep(1000);
|
||||
userM.acceptMembershipRequest(currUser.getUserId(), vreGroupId, true, replierUsername, "Automatic acceptance request at " + new Date());
|
||||
_log.info("fakeRequest accepted");
|
||||
|
||||
//add the user to the VRE
|
||||
userM.assignUserToGroup(vreGroupId, userM.getUserId(user.getId()));
|
||||
userM.assignUserToGroup(vreGroupId, currUser.getUserId());
|
||||
//send notification
|
||||
sendNotificationToUser(vreGroupId, user);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue