diff --git a/.classpath b/.classpath
index 02eafb5..8d525ba 100644
--- a/.classpath
+++ b/.classpath
@@ -1,19 +1,27 @@
-
+
-
+
+
+
+
+
-
+
+
+
+
+
@@ -31,5 +39,5 @@
-
+
diff --git a/.project b/.project
index 698834c..549e7b2 100644
--- a/.project
+++ b/.project
@@ -55,5 +55,6 @@
org.eclipse.wst.common.project.facet.core.nature
org.eclipse.wst.jsdt.core.jsNature
com.google.gwt.eclipse.core.gwtNature
+ com.liferay.ide.core.liferayNature
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 570b862..7aaf430 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -5,9 +5,6 @@
-
- uses
-
diff --git a/distro/changelog.xml b/distro/changelog.xml
index cab1ace..cfd03d3 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -1,4 +1,8 @@
+
+ Changed visbility of users depending on the gateway
+
Ported to Liferay 6.2
diff --git a/pom.xml b/pom.xml
index 26c39a0..aafbfc3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
org.gcube.portlets.admin
register-vre-users
war
- 2.0.0-SNAPSHOT
+ 2.1.0-SNAPSHOT
Register VRE Users
Register VRE Users Portlet allow to select a user from the portal and add her to the VRE.
@@ -98,16 +98,6 @@
home-library
provided
-
- org.gcube.portlets.widgets
- invite-friends-widget
- [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
-
-
- org.gcube.portal
- invites-common-library
- [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
-
org.gcube.portal
social-networking-library
@@ -133,6 +123,10 @@
usermanagement-core
provided
+
+ org.gcube.common.portal
+ portal-manager
+
com.liferay.portal
portal-service
diff --git a/src/main/java/org/gcube/portlets/admin/manageusers/client/presenter/VREDeploymentPresenter.java b/src/main/java/org/gcube/portlets/admin/manageusers/client/presenter/VREDeploymentPresenter.java
index a85215c..92813ba 100644
--- a/src/main/java/org/gcube/portlets/admin/manageusers/client/presenter/VREDeploymentPresenter.java
+++ b/src/main/java/org/gcube/portlets/admin/manageusers/client/presenter/VREDeploymentPresenter.java
@@ -6,7 +6,6 @@ import java.util.List;
import org.gcube.portlets.admin.manageusers.client.ManageUsersServiceAsync;
import org.gcube.portlets.admin.manageusers.client.view.Display;
import org.gcube.portlets.admin.manageusers.shared.PortalUserDTO;
-import org.gcube.portlets.widgets.inviteswidget.client.ui.InviteWidget;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
@@ -16,13 +15,9 @@ import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.MessageBox;
-import com.extjs.gxt.ui.client.widget.Window;
-import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HasWidgets;
-import com.google.gwt.user.client.ui.SimplePanel;
-import com.google.gwt.user.client.ui.VerticalPanel;
/**
*
* @author Massimiliano Assante (assante@isti.cnr.it)
@@ -56,16 +51,11 @@ public class VREDeploymentPresenter implements Presenter {
}
};
- ///*** BUTTONS & Menu
- SelectionListener inviteButtonListener = new SelectionListener() {
- public void componentSelected(ComponentEvent ce) {
- doOpenInviteWidget();
- }
- };
+
display.getApproveButton().addSelectionListener(approvesl);
display.getApproveMenu().addSelectionListener(approvesl);
- display.getInviteButton().addSelectionListener(inviteButtonListener);
+
// REFRESH
display.getRefreshButton().addSelectionListener( new SelectionListener() {
@@ -114,16 +104,13 @@ public class VREDeploymentPresenter implements Presenter {
});
}
- private void doOpenInviteWidget() {
- display.displayInviteUsersPanel();
- }
private void doApprove(final List selectedUsers) {
if (selectedUsers != null) {
String users = "";
for (int i = 0; i < selectedUsers.size(); i++) {
PortalUserDTO user = selectedUsers.get(i);
- users += user.getLastName() + ", ";
+ users += user.getName() + " " + user.getLastName() + ", ";
}
MessageBox.confirm("Please Confirm", "You are about to register: " +users+ "?", new Listener() {
diff --git a/src/main/java/org/gcube/portlets/admin/manageusers/client/view/Display.java b/src/main/java/org/gcube/portlets/admin/manageusers/client/view/Display.java
index 890fc77..3d2a1c2 100644
--- a/src/main/java/org/gcube/portlets/admin/manageusers/client/view/Display.java
+++ b/src/main/java/org/gcube/portlets/admin/manageusers/client/view/Display.java
@@ -18,12 +18,12 @@ public interface Display {
void setGridContextMenu() ;
Button getApproveButton();
- Button getInviteButton();
+
Button getRefreshButton();
MenuItem getApproveMenu();
GridSelectionModel getGridSelectionModel();
- void displayInviteUsersPanel();
+
}
diff --git a/src/main/java/org/gcube/portlets/admin/manageusers/client/view/VREDeploymentView.java b/src/main/java/org/gcube/portlets/admin/manageusers/client/view/VREDeploymentView.java
index fd410dd..8fa9fbe 100644
--- a/src/main/java/org/gcube/portlets/admin/manageusers/client/view/VREDeploymentView.java
+++ b/src/main/java/org/gcube/portlets/admin/manageusers/client/view/VREDeploymentView.java
@@ -6,7 +6,6 @@ import java.util.List;
import org.gcube.portlets.admin.manageusers.client.ManageVreUsers;
import org.gcube.portlets.admin.manageusers.shared.PortalUserDTO;
import org.gcube.portlets.user.gcubewidgets.client.GCubePanel;
-import org.gcube.portlets.widgets.inviteswidget.client.ui.InviteWidget;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SelectionMode;
@@ -51,7 +50,7 @@ public class VREDeploymentView extends Composite implements Display {
private Button approveButton;
private Button refreshButton;
- private Button inviteButton;
+
private MenuItem approveMenu;
private final CheckBoxSelectionModel sm = new CheckBoxSelectionModel();
@@ -170,24 +169,12 @@ public class VREDeploymentView extends Composite implements Display {
approveButton.setEnabled(false);
- inviteButton = new Button("Invite a user by email");
-
-
+
initWidget(mainPanel);
updateSize();
}
- @Override
- public void displayInviteUsersPanel() {
- VerticalPanel sp = new VerticalPanel();
- sp.getElement().getStyle().setMarginTop(10, Unit.PX);
- sp.getElement().getStyle().setMarginBottom(10, Unit.PX);
- sp.setSpacing(10);
- InviteWidget iw = new InviteWidget();
- sp.add(iw);
- mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
- mainPanel.add(sp);
- }
+
/**
* display the list of wfDocuments
@@ -207,7 +194,7 @@ public class VREDeploymentView extends Composite implements Display {
gridPanel.setButtonAlign(HorizontalAlignment.CENTER);
gridPanel.addButton(approveButton);
gridPanel.addButton(refreshButton);
- gridPanel.addButton(inviteButton);
+
gridPanel.setBorders(false);
tablePanel.add(gridPanel);
tablePanel.setLayout(new FitLayout());
@@ -243,8 +230,8 @@ public class VREDeploymentView extends Composite implements Display {
int rightScrollBar = 17;
int rootHeight = Window.getClientHeight() - (topBorder + 150);
int rootWidth = Window.getClientWidth() - 2*leftBorder - rightScrollBar;
- tablePanel.setPixelSize(rootWidth+15, rootHeight+30);
- mainPanel.setPixelSize(rootWidth+15, rootHeight+10);
+ tablePanel.setPixelSize(rootWidth, rootHeight);
+ mainPanel.setPixelSize(rootWidth, rootHeight);
}
@@ -339,8 +326,5 @@ public class VREDeploymentView extends Composite implements Display {
public MenuItem getApproveMenu() { return approveMenu;
}
- @Override
- public Button getInviteButton() {
- return inviteButton;
- }
+
}
diff --git a/src/main/java/org/gcube/portlets/admin/manageusers/server/ManageUsersServiceImpl.java b/src/main/java/org/gcube/portlets/admin/manageusers/server/ManageUsersServiceImpl.java
index c6d2aa6..869bb12 100644
--- a/src/main/java/org/gcube/portlets/admin/manageusers/server/ManageUsersServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/admin/manageusers/server/ManageUsersServiceImpl.java
@@ -3,6 +3,8 @@ package org.gcube.portlets.admin.manageusers.server;
import java.util.ArrayList;
import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
@@ -11,6 +13,7 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
+import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.portal.custom.communitymanager.SiteManagerUtil;
@@ -30,11 +33,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+import com.liferay.portal.model.Group;
import com.liferay.portal.model.User;
+import com.liferay.portal.model.VirtualHost;
import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
import com.liferay.portal.security.permission.PermissionThreadLocal;
+import com.liferay.portal.service.LayoutSetLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
+import com.liferay.portal.service.VirtualHostLocalServiceUtil;
@SuppressWarnings("serial")
public class ManageUsersServiceImpl extends RemoteServiceServlet implements ManageUsersService {
@@ -108,7 +115,29 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Man
}
}
-
+ /**
+ *
+ * @param request
+ * @return the current Group instance based on the request
+ * @throws PortalException
+ * @throws SystemException
+ */
+ private Group getSiteFromServletRequest(final HttpServletRequest request) throws Exception {
+ String serverName = request.getServerName();
+ Group site = null;
+ List vHosts = VirtualHostLocalServiceUtil.getVirtualHosts(0, VirtualHostLocalServiceUtil.getVirtualHostsCount());
+ for (VirtualHost virtualHost : vHosts) {
+ if (virtualHost.getHostname().compareTo("localhost") != 0 &&
+ virtualHost.getLayoutSetId() != 0 &&
+ virtualHost.getHostname().compareTo(serverName) == 0) {
+ long layoutSetId = virtualHost.getLayoutSetId();
+ site = LayoutSetLocalServiceUtil.getLayoutSet(layoutSetId).getGroup();
+ return site;
+ }
+ }
+ _log.warn("serverName is " + serverName + " but i could not find any virtualHost associated to it");
+ return null;
+ }
/**
* Retrieves all the users that are registered to portal but are not registered to the current VO
*
@@ -126,8 +155,13 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Man
_log.trace("Setting Permission ok!");
ArrayList unregisteredUsers = new ArrayList();
- List notBelongingUsers = userM.listUnregisteredUsersByGroup(getCurrentGroupID());
- for (GCubeUser u : notBelongingUsers) {
+
+ //List notBelongingUsers = userM.listUnregisteredUsersByGroup(getCurrentGroupID());
+ long currSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
+ List nonBelongingUsers = userM.listUsersByGroup(currSiteGroupId); //the users of i-marine or services etc
+ nonBelongingUsers.removeAll(userM.listUsersByGroup(getCurrentGroupID()));
+
+ for (GCubeUser u : nonBelongingUsers) {
String id = u.getUsername();
User user = UserLocalServiceUtil.getUserByScreenName(companyId, id);
String position = "";
@@ -170,10 +204,11 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Man
public boolean registerUsers(List users2Register) {
for (PortalUserDTO user : users2Register) {
try {
+ long vreGroupId = getCurrentGroupID();
//add the user to the VRE
- userM.assignUserToGroup(getCurrentGroupID(), userM.getUserId(user.getId()));
+ userM.assignUserToGroup(vreGroupId, userM.getUserId(user.getId()));
//send notification
- sendNotificationToUser(user);
+ sendNotificationToUser(vreGroupId, user);
}
catch (Exception e) {
e.printStackTrace();
@@ -188,7 +223,7 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Man
* @return
* @throws Exception
*/
- private boolean sendNotificationToUser(PortalUserDTO addressee) throws Exception {
+ private boolean sendNotificationToUser(long groupId, PortalUserDTO addressee) throws Exception {
ASLSession session = getASLSession();
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
@@ -198,8 +233,13 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Man
List recipients = new ArrayList();
recipients.add(new GenericItemBean(addressee.getId(), addressee.getId(), addressee.getName() + " " + addressee.getLastName(), ""));
- String subject = "Registration to Group Notification";
- String body = "Dear "+addressee.getName()+", \n\n" + session.getUserFullName() + " has registered you to the group " + session.getGroupName()+".";
+ String gatewayName = PortalContext.getConfiguration().getGatewayName(getThreadLocalRequest());
+ String gatewayURL = PortalContext.getConfiguration().getGatewayURL(getThreadLocalRequest());
+ String vreURL = gatewayURL + "/group" + new LiferayGroupManager().getGroup(groupId).getFriendlyURL();
+
+ String subject = "Registration to VRE notification";
+ String body = "Dear "+addressee.getName()+", \n\n I just registered you to the VRE " + session.getGroupName()+" on the " + gatewayName + ". \n\n";
+ body += "Please, click here to access the VRE: " + vreURL;
String messageId = workspace.getWorkspaceMessageManager().sendMessageToPortalLogins(subject, body, new ArrayList(), recipientIds);
_log.debug("Sending message notification to: " + recipientIds.toString());
diff --git a/src/main/resources/org/gcube/portlets/admin/manageusers/ManageVreUsers.gwt.xml b/src/main/resources/org/gcube/portlets/admin/manageusers/ManageVreUsers.gwt.xml
index 9bd5287..2656a54 100644
--- a/src/main/resources/org/gcube/portlets/admin/manageusers/ManageVreUsers.gwt.xml
+++ b/src/main/resources/org/gcube/portlets/admin/manageusers/ManageVreUsers.gwt.xml
@@ -9,10 +9,6 @@
-
-
-
-
diff --git a/src/main/webapp/ManageVreUsers.css b/src/main/webapp/ManageVreUsers.css
index a5b3be0..93c5963 100644
--- a/src/main/webapp/ManageVreUsers.css
+++ b/src/main/webapp/ManageVreUsers.css
@@ -1,5 +1,5 @@
@import url(newtheme.css);
-
+@import url(coherence.css);
.approve-icon {
background-image:url(images/vre_approve.png) !important;
}
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 1b65202..03aa7db 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -9,19 +9,11 @@
org.gcube.portlets.admin.manageusers.server.ManageUsersServiceImpl
-
- greetServlet
- org.gcube.portlets.widgets.inviteswidget.server.InviteServiceImpl
-
+
manageUsersServlet
/managevreusers/manageUsersServlet
-
- greetServlet
- /managevreusers/greet
-
-
diff --git a/src/main/webapp/coherence.css b/src/main/webapp/coherence.css
new file mode 100644
index 0000000..f72465d
--- /dev/null
+++ b/src/main/webapp/coherence.css
@@ -0,0 +1,93 @@
+#bottombar {
+ width: 100% !important;
+}
+
+.x-menubar {
+ background-image: none;
+ background-color: #FFF;
+}
+
+.x-panel-body-noheader {
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+}
+
+.x-border-layout-ct {
+ background-color: transparent;
+ border-color: transparent;
+}
+
+.x-toolbar {
+ border-color: transparent;
+ background-image: none;
+ background-color: #FFF;
+}
+
+.x-panel-header {
+ background-image: none;
+ background-color: #FFF;
+}
+
+.x-toolbar .xtb-sep {
+ background-image: none !important;
+ background-color: transparent;
+}
+
+.x-accordion-hd {
+ background-position: 0 0px;
+}
+
+.x-status-text,.x-tree3-node-text,.x-status .x-status-text,.x-toolbar label,.x-component,.x-btn button
+ {
+ color: #4c68a6;
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
+ "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
+ font-weight: 300;
+ font-size: 12px !important;
+}
+
+.x-grid-group-hd .x-grid-group-div {
+ color: #4c68a6;
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
+ "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
+ font-weight: normal;
+ font-size: 12px !important;
+}
+
+.x-status-text-panel {
+ border-color: transparent;
+}
+
+.x-panel-mc {
+ padding-top: 5px;
+ background: #FFF url(images/bg-pattern.png) repeat;
+ border-color: #226599;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+
+.ext-el-mask-msg {
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ border-width: 2px;
+ background-color: #FFF;
+ background-image: none;
+}
+
+.ext-el-mask-msg div {
+ color: #4c68a6;
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
+ "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
+ font-weight: 300;
+ font-size: 12px !important;
+ border-color: transparent;
+ background-color: transparent;
+}
+
+.loading-indicator {
+ background-position: 5px 50%;
+ background-image: url("images/loader.gif");
+}
\ No newline at end of file