Removed the Leave Group option (that has been moved into the vre settings portlet a.k.a. Questions)
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gcube-loggedin@128517 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3b25bc3609
commit
75782b29d0
|
@ -26,11 +26,6 @@
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.liferay.ide.eclipse.server.tomcat.runtimeClasspathProvider/Liferay v6.2 CE (Tomcat 7) (2)">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="owner.project.facets" value="jst.web"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
|
|
@ -3,12 +3,6 @@
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
<dependent-module archiveName="gcube-widgets-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
<dependent-module archiveName="session-checker-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="gcube-loggedin"/>
|
<property name="context-root" value="gcube-loggedin"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<runtime name="Liferay v6.2 CE (Tomcat 7) (2)"/>
|
|
||||||
<fixed facet="wst.jsdt.web"/>
|
<fixed facet="wst.jsdt.web"/>
|
||||||
<installed facet="jst.web" version="3.0"/>
|
<installed facet="jst.web" version="3.0"/>
|
||||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
|
|
@ -10,9 +10,5 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
*/
|
*/
|
||||||
@RemoteServiceRelativePath("LoggedinServiceImpl")
|
@RemoteServiceRelativePath("LoggedinServiceImpl")
|
||||||
public interface LoggedinService extends RemoteService {
|
public interface LoggedinService extends RemoteService {
|
||||||
|
|
||||||
VObject getSelectedRE(String portalURL);
|
VObject getSelectedRE(String portalURL);
|
||||||
|
|
||||||
String removeUserFromVRE();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,5 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
* The async counterpart of <code>GreetingService</code>.
|
* The async counterpart of <code>GreetingService</code>.
|
||||||
*/
|
*/
|
||||||
public interface LoggedinServiceAsync {
|
public interface LoggedinServiceAsync {
|
||||||
|
|
||||||
|
|
||||||
void getSelectedRE(String portalURL, AsyncCallback<VObject> callback);
|
void getSelectedRE(String portalURL, AsyncCallback<VObject> callback);
|
||||||
|
|
||||||
void removeUserFromVRE(AsyncCallback<String> callback);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,25 +2,16 @@ package org.gcube.portlets.user.gcubeloggedin.client.ui;
|
||||||
|
|
||||||
import org.gcube.portlets.user.gcubeloggedin.client.LoggedinServiceAsync;
|
import org.gcube.portlets.user.gcubeloggedin.client.LoggedinServiceAsync;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
|
|
||||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.Heading;
|
import com.github.gwtbootstrap.client.ui.Heading;
|
||||||
import com.github.gwtbootstrap.client.ui.Hero;
|
import com.github.gwtbootstrap.client.ui.Hero;
|
||||||
import com.github.gwtbootstrap.client.ui.Image;
|
import com.github.gwtbootstrap.client.ui.Image;
|
||||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.uibinder.client.UiHandler;
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
import com.google.gwt.user.client.DOM;
|
|
||||||
import com.google.gwt.user.client.Window;
|
|
||||||
import com.google.gwt.user.client.Window.Location;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -40,20 +31,16 @@ public class AboutView extends Composite {
|
||||||
public AboutView() {
|
public AboutView() {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
}
|
}
|
||||||
private WarningAlert wa;
|
|
||||||
private String vreDescription;
|
private String vreDescription;
|
||||||
@UiField Image vreImage;
|
@UiField Image vreImage;
|
||||||
@UiField Heading vreName;
|
@UiField Heading vreName;
|
||||||
@UiField HTML description;
|
@UiField HTML description;
|
||||||
@UiField Button seeMore;
|
@UiField Button seeMore;
|
||||||
@UiField Button leaveButton;
|
|
||||||
@UiField Hero mainPanel;
|
@UiField Hero mainPanel;
|
||||||
|
|
||||||
private LoggedinServiceAsync loggedinService;
|
|
||||||
|
|
||||||
public AboutView(VObject vobj, LoggedinServiceAsync loggedinService) {
|
public AboutView(VObject vobj, LoggedinServiceAsync loggedinService) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.loggedinService = loggedinService;
|
|
||||||
this.vreDescription = vobj.getDescription();
|
this.vreDescription = vobj.getDescription();
|
||||||
vreName.setText(vobj.getName());
|
vreName.setText(vobj.getName());
|
||||||
vreImage.setUrl(vobj.getImageURL());
|
vreImage.setUrl(vobj.getImageURL());
|
||||||
|
@ -66,22 +53,6 @@ public class AboutView extends Composite {
|
||||||
seeMore.setVisible(true);
|
seeMore.setVisible(true);
|
||||||
seeMore.setText(SEE_MORE);
|
seeMore.setText(SEE_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vobj instanceof VREClient && !vobj.isMandatory()) {
|
|
||||||
leaveButton.setVisible(true);
|
|
||||||
wa = new WarningAlert("Are you sure you want to leave this group? "
|
|
||||||
+ "By leaving this group you will no longer receive updates and lose the workspace folder related to the group.", this);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//remove the login button
|
|
||||||
Scheduler.get().scheduleDeferred(new Command() {
|
|
||||||
public void execute () {
|
|
||||||
DOM.getElementById("removable-item-li").removeFromParent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
boolean open = false;
|
boolean open = false;
|
||||||
@UiHandler("seeMore")
|
@UiHandler("seeMore")
|
||||||
|
@ -98,33 +69,6 @@ public class AboutView extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiHandler("leaveButton")
|
|
||||||
void onUnsubscribe(ClickEvent e) {
|
|
||||||
mainPanel.add(wa);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void abandonGroup() {
|
|
||||||
mainPanel.remove(wa);
|
|
||||||
final Widget loading = getLoadingHTML();
|
|
||||||
mainPanel.add(loading);
|
|
||||||
loggedinService.removeUserFromVRE(new AsyncCallback<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String result) {
|
|
||||||
if (result != null)
|
|
||||||
Location.assign(result);
|
|
||||||
else
|
|
||||||
CheckSession.showLogoutDialog();
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
mainPanel.remove(loading);
|
|
||||||
Window.alert("We're sorry we couldn't reach the server, try again later ... " + caught.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
package org.gcube.portlets.user.gcubeloggedin.client.ui;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.gcubewidgets.client.elements.*;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.dom.client.Element;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
|
||||||
import com.google.gwt.uibinder.client.UiHandler;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
|
||||||
|
|
||||||
public class WarningAlert extends Composite {
|
|
||||||
|
|
||||||
private static WarningAlertUiBinder uiBinder = GWT
|
|
||||||
.create(WarningAlertUiBinder.class);
|
|
||||||
|
|
||||||
interface WarningAlertUiBinder extends UiBinder<Widget, WarningAlert> {
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiField Element errorMessage;
|
|
||||||
@UiField Span cancelHandler;
|
|
||||||
@UiField Span confirmHandler;
|
|
||||||
|
|
||||||
private AboutView owner;
|
|
||||||
|
|
||||||
public WarningAlert(String message, AboutView owner) {
|
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
|
||||||
errorMessage.setInnerText(message);
|
|
||||||
this.owner = owner;
|
|
||||||
cancelHandler.setHTML(" Cancel");
|
|
||||||
|
|
||||||
confirmHandler.setHTML(" Confirm Leave");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@UiHandler("cancelHandler")
|
|
||||||
void onCloseClick(ClickEvent e) {
|
|
||||||
this.removeFromParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiHandler("confirmHandler")
|
|
||||||
void onConfirmClick(ClickEvent e) {
|
|
||||||
owner.abandonGroup();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
|
||||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
|
||||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
|
||||||
xmlns:m="urn:import:org.gcube.portlets.user.gcubewidgets.client.elements">
|
|
||||||
<ui:style>
|
|
||||||
.alert {
|
|
||||||
border: 1px solid #FAEBCC;
|
|
||||||
border-radius: 4px;
|
|
||||||
margin: 20px;
|
|
||||||
padding: 15px;
|
|
||||||
background-color: #FCF8D4;
|
|
||||||
color: #8A6D3F;
|
|
||||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile-link {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile-link:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
cursor: hand;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
</ui:style>
|
|
||||||
<g:HTMLPanel styleName="{style.alert}">
|
|
||||||
<div ui:field="errorMessage"></div>
|
|
||||||
<m:Span ui:field="confirmHandler" styleName="{style.profile-link}"></m:Span>
|
|
||||||
<span> or </span>
|
|
||||||
<m:Span ui:field="cancelHandler" styleName="{style.profile-link}"></m:Span>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
</ui:UiBinder>
|
|
|
@ -7,8 +7,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
import org.gcube.common.portal.PortalContext;
|
|
||||||
import org.gcube.common.portal.mailing.EmailNotification;
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.client.LoggedinService;
|
import org.gcube.portlets.user.gcubeloggedin.client.LoggedinService;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
||||||
|
@ -16,8 +14,6 @@ import org.gcube.portlets.user.gcubeloggedin.shared.VObject.UserBelongingClient;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
|
import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
|
||||||
import org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl;
|
import org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||||
|
@ -27,7 +23,6 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
@ -54,20 +49,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return true if you're running into the portal, false if in development
|
|
||||||
*/
|
|
||||||
private boolean isWithinPortal() {
|
|
||||||
try {
|
|
||||||
UserLocalServiceUtil.getService();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
|
|
||||||
_log.trace("Development Mode ON");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* return the current selected VRE
|
* return the current selected VRE
|
||||||
*/
|
*/
|
||||||
|
@ -139,49 +121,6 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
VREClient vre = new VREClient(name, "", desc, logoURL, "", UserBelongingClient.BELONGING, isMandatory, isRequestBasedGroup);
|
VREClient vre = new VREClient(name, "", desc, logoURL, "", UserBelongingClient.BELONGING, isMandatory, isRequestBasedGroup);
|
||||||
return vre;
|
return vre;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*@return the redirect url if everything goes ok, null otherwise
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String removeUserFromVRE() {
|
|
||||||
String username = getASLSession().getUsername();
|
|
||||||
if (username.compareTo("test.user") == 0)
|
|
||||||
return null;
|
|
||||||
_log.debug("Going to remove user from the current Group: " + getCurrentGroupID() + ". Username is: " + username);
|
|
||||||
UserManager userM = new LiferayUserManager();
|
|
||||||
try {
|
|
||||||
userM.dismissUserFromGroup(getCurrentGroupID(), userM.getUserId(username));
|
|
||||||
sendUserUnregisteredNotification(username, getASLSession().getScope(), PortalContext.getConfiguration().getGatewayURL(getThreadLocalRequest()), PortalContext.getConfiguration().getGatewayName());
|
|
||||||
return "/";
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current group ID
|
|
||||||
*
|
|
||||||
* @return the current group ID or null if an exception is thrown
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private long getCurrentGroupID(){
|
|
||||||
ASLSession session = getASLSession();
|
|
||||||
_log.debug("The current group NAME is --> " + session.getGroupName());
|
|
||||||
try {
|
|
||||||
try {
|
|
||||||
GroupManager groupM = new LiferayGroupManager();
|
|
||||||
return groupM.getGroupId(session.getGroupName());
|
|
||||||
} catch (UserManagementSystemException e) {
|
|
||||||
throw new Exception(e.getMessage(), e.getCause());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected static ArrayList<String> getAdministratorsEmails(String scope) {
|
protected static ArrayList<String> getAdministratorsEmails(String scope) {
|
||||||
LiferayUserManager userManager = new LiferayUserManager();
|
LiferayUserManager userManager = new LiferayUserManager();
|
||||||
|
@ -192,7 +131,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
_log.debug("Number of groups retrieved: " + allGroups.size());
|
_log.debug("Number of groups retrieved: " + allGroups.size());
|
||||||
for (int i = 0; i < allGroups.size(); i++) {
|
for (int i = 0; i < allGroups.size(); i++) {
|
||||||
long grId = allGroups.get(i).getGroupId();
|
long grId = allGroups.get(i).getGroupId();
|
||||||
String groupScope = groupManager.getScope(grId);
|
String groupScope = groupManager.getInfrastructureScope(grId);
|
||||||
_log.debug("Comparing: " + groupScope + " " + scope);
|
_log.debug("Comparing: " + groupScope + " " + scope);
|
||||||
if (groupScope.equals(scope)) {
|
if (groupScope.equals(scope)) {
|
||||||
groupId = allGroups.get(i).getGroupId();
|
groupId = allGroups.get(i).getGroupId();
|
||||||
|
@ -222,46 +161,4 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
}
|
}
|
||||||
return adminEmailsList;
|
return adminEmailsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param scope .
|
|
||||||
* @param optionalMessage .
|
|
||||||
*/
|
|
||||||
public void sendUserUnregisteredNotification(String username, String scope, String portalbasicurl, String gatewayName) {
|
|
||||||
ArrayList<String> adminEmails = getAdministratorsEmails(scope);
|
|
||||||
UserManager um = new LiferayUserManager();
|
|
||||||
GCubeUser currUser = null;
|
|
||||||
try {
|
|
||||||
currUser = um.getUserByUsername(username);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
String name = currUser.getFirstName();
|
|
||||||
String lastname = currUser.getLastName();
|
|
||||||
|
|
||||||
StringBuffer body = new StringBuffer();
|
|
||||||
body.append("<p>Dear manager of "+ scope +",<br />this email message was automatically generated by " + portalbasicurl +" to inform you that ");
|
|
||||||
body.append("</p>");
|
|
||||||
body.append("<p>");
|
|
||||||
body.append("<b>"+name + " " + lastname +"</b> has left the following environment: ");
|
|
||||||
body.append("<br /><br />");
|
|
||||||
body.append("<b>" + scope+"</b>");
|
|
||||||
body.append("<br />");
|
|
||||||
body.append("<br />");
|
|
||||||
body.append("<b>Username: </b>" + username);
|
|
||||||
body.append("<br />");
|
|
||||||
body.append("<b>e-mail: </b>" + currUser.getEmail());
|
|
||||||
body.append("</p>");
|
|
||||||
|
|
||||||
String[] allMails = new String[adminEmails.size()];
|
|
||||||
|
|
||||||
adminEmails.toArray(allMails);
|
|
||||||
|
|
||||||
EmailNotification mailToAdmin = new EmailNotification(allMails , "Unregistration from VRE", body.toString(), getThreadLocalRequest());
|
|
||||||
|
|
||||||
mailToAdmin.sendEmail();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ package org.gcube.portlets.user.gcubeloggedin.server.portlet;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.portlet.ActionRequest;
|
|
||||||
import javax.portlet.ActionResponse;
|
|
||||||
import javax.portlet.GenericPortlet;
|
import javax.portlet.GenericPortlet;
|
||||||
import javax.portlet.PortletException;
|
import javax.portlet.PortletException;
|
||||||
import javax.portlet.PortletRequestDispatcher;
|
import javax.portlet.PortletRequestDispatcher;
|
||||||
|
@ -13,10 +11,6 @@ import javax.portlet.RenderResponse;
|
||||||
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
|
|
||||||
import com.liferay.portal.kernel.exception.PortalException;
|
|
||||||
import com.liferay.portal.kernel.exception.SystemException;
|
|
||||||
import com.liferay.portal.model.Organization;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LoggedinPortlet Portlet Class
|
* LoggedinPortlet Portlet Class
|
||||||
* @author massi
|
* @author massi
|
||||||
|
@ -33,22 +27,4 @@ public class LoggedinPortlet extends GenericPortlet {
|
||||||
dispatcher.include(request, response);
|
dispatcher.include(request, response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param currentGroup
|
|
||||||
* @return true id the organization is a VO
|
|
||||||
* @throws SystemException .
|
|
||||||
* @throws PortalException .
|
|
||||||
*/
|
|
||||||
private boolean isVO(Organization currentOrg) throws PortalException, SystemException {
|
|
||||||
return (currentOrg.getParentOrganization().getParentOrganization() == null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void processAction(ActionRequest request, ActionResponse response)
|
|
||||||
throws PortletException, IOException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue