Commit 44c602f5 authored by Hélène Ortiz's avatar Hélène Ortiz

4.0.47

parent 3d24cb90
4.0.46 dd/mm/2020
4.0.47 17/07/2020
------
* Fix bug: staff users have access to all proposals.
4.0.46 17/07/2020
------
* Licence was missing in some files.
* Fix bug: jar from NomadGUISpecialModules were saved in home directory instead of tmp.
......@@ -7,6 +11,7 @@
* Fix bug: when an user drags and drops a forloop at the beginning or in the middle of the launch pad, other clients crashed.
* (ClassCastException: GridData cannot be cast to FormData). extraTitleLabel layoutdata was set too late (in init method).
* Now layoutdata for extraTitleLabel is set in the constructor SWTCommandBoxPeer.
* Manage specific error messages for remote computers: multiple connections per user or multiple clients per endpoint.
4.0.45 08/07/2020
------
......
......@@ -25,6 +25,8 @@ clientWrongLoginTitle=Login failed
clientWrongLoginMessage=We don't recognise the login and password you entered. Please try again.
clientAlreadyLaunchedTitle=Launch failed
clientAlreadyLaunchedMessage=Nomad is already running. Please quit before relaunching.
multipleClientsPerEndPointMessage=Nomad is already running. Please quit before relaunching.
multipleConnectionsPerUserMessage=You already launched Nomad in another environment.\nPlease quit it before relaunching.
cannotGlobalySetPropertiesFor=Cannot globally set property values for
nameConflictOnSaveTitle=Error while saving script
nameConflictOnSaveMessage=Cannot save script: there is at least one circular reference.\nYou need to change script name.
......
No preview for this file type
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadgui</artifactId>
<version>4.0.45</version>
<version>4.0.47</version>
<name>NomadGUI</name>
<description>Graphical user interface for Nomad</description>
<scm>
......@@ -140,7 +140,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>4.0.30-beta</version>
<version>4.0.28</version>
</dependency>
<dependency> <!-- For CollectionUtils -->
<groupId>org.apache.commons</groupId>
......
......@@ -484,7 +484,7 @@ public class CommandWindow {
simulatedServers.put(serverId, simulatedServer);
CommandWindow.getInstance().openSimulationTab(serverId);
} else if (loginStatus == ServerConnection.LOGIN_REFUSED) {
} else if (loginStatus == ServerConnection.LOGIN_REFUSED_MULTIPLE_CLIENTS || loginStatus == ServerConnection.LOGIN_REFUSED_MULTIPLE_CONNECTIONS) {
System.out.println("Login refused");
} else {
System.out.println("Login failed");
......
......@@ -19,9 +19,10 @@
package fr.ill.ics.client.control.login;
import fr.ill.ics.bridge.LoginManager;
import fr.ill.ics.bridge.LoginManager.ClientAlreadyLaunchedException;
import fr.ill.ics.bridge.LoginManager.ConnectionFailure;
import fr.ill.ics.bridge.LoginManager.LoginIncorrectException;
import fr.ill.ics.bridge.LoginManager.MultipleClientsPerEndpointNotAllowedException;
import fr.ill.ics.bridge.LoginManager.MultipleConnectionsPerUserNotAllowedException;
import fr.ill.ics.bridge.command.CommandZoneWrapper;
import fr.ill.ics.util.exception.ExitException;
......@@ -29,7 +30,9 @@ public class ServerConnection {
public final static int LOGIN_OK = 0;
public final static int LOGIN_NOT_OK = 1;
public final static int LOGIN_REFUSED = 2;
public final static int LOGIN_REFUSED_MULTIPLE_CLIENTS = 2;
public final static int LOGIN_REFUSED_MULTIPLE_CONNECTIONS = 3;
private int loginState = -1;
......@@ -38,10 +41,12 @@ public class ServerConnection {
try {
LoginManager.getInstance().login(login, standalone, serverId);
loginState = LOGIN_OK;
} catch (MultipleClientsPerEndpointNotAllowedException e) {
loginState = LOGIN_REFUSED_MULTIPLE_CLIENTS;
} catch (MultipleConnectionsPerUserNotAllowedException e) {
loginState = LOGIN_REFUSED_MULTIPLE_CONNECTIONS;
} catch (LoginIncorrectException e) {
loginState = LOGIN_NOT_OK;
} catch (ClientAlreadyLaunchedException e) {
loginState = LOGIN_REFUSED;
} catch (ConnectionFailure e) {
if (serverId.equals(CommandZoneWrapper.SERVER_ID)) {
throw new ExitException(1);
......@@ -56,10 +61,12 @@ public class ServerConnection {
try {
LoginManager.getInstance().login(login, standalone, CommandZoneWrapper.SERVER_ID);
loginState = LOGIN_OK;
} catch (MultipleClientsPerEndpointNotAllowedException e) {
loginState = LOGIN_REFUSED_MULTIPLE_CLIENTS;
} catch (MultipleConnectionsPerUserNotAllowedException e) {
loginState = LOGIN_REFUSED_MULTIPLE_CONNECTIONS;
} catch (LoginIncorrectException e) {
loginState = LOGIN_NOT_OK;
} catch (ClientAlreadyLaunchedException e) {
loginState = LOGIN_REFUSED;
} catch (ConnectionFailure e) {
throw new ExitException(1);
}
......
......@@ -83,7 +83,7 @@ public class Startup {
String[] cameoArgs = {ConfigManager.getInstance().getServerEndpoint() + ":nomadgui"};
Application.This.init(cameoArgs);
ServerInstance.getInstance().init();
if (ConfigManager.getInstance().isRemoteClient()) {
// Save nomadendpoint in local file (for NomadMail)
try {
......@@ -96,7 +96,7 @@ public class Startup {
e.printStackTrace();
}
}
// Initialise the information message
informationKey = "clientConnectedToServerMessage";
break;
......@@ -191,7 +191,7 @@ public class Startup {
ConfigManager.getInstance().savePreference(ConfigManager.REMOTE_INSTRUMENT, RemoteControlManager.getInstance().getInstrumentName());
ConfigManager.getInstance().savePreferences();
}
// Initialise the plugin manager
PluginManager.getInstance().init();
// set information key for next stage
......@@ -316,22 +316,25 @@ public class Startup {
MainWindow.getInstance().onExit();
}
private void checkInRemoteUser() {
// 1. Check login+password
ConnectionResult connectionResult = loginRemote();
if (connectionResult.getResult() == UserConnection.SUCCESS_CODE) {
// 2. Check that user has a proposal on this instrument
if (!UserConnection.getInstance().userHasProposal()) {
// Staff users have access to all proposals
if (!UserConnection.getInstance().userIsStaff()) {
// Staff users have access to all proposals, check only for non-staff ones
if (!UserConnection.getInstance().userIsStaff()) {
// 2. Check that user has a proposal on this instrument
if (!UserConnection.getInstance().userHasProposal()) {
remoteClientUnauthorized(ConfigManager.getInstance().getString("remoteClientHasNoProposalMessage") + " " + RemoteControlManager.getInstance().getInstrumentName(), true);
}
} else {
// 3. Check now that current proposal on instrument is part of user's proposals
// If current proposal is "internal use", access is granted too
if (!UserConnection.getInstance().userHasCurrentProposal()) {
remoteClientUnauthorized(ConfigManager.getInstance().getString("remoteClientHasNotCurrentProposalMessage") + " " + RemoteControlManager.getInstance().getInstrumentName(), true);
} else {
// 3. Check now that current proposal on instrument is part of user's proposals
// If current proposal is "internal use", access is granted too
if (!UserConnection.getInstance().userHasCurrentProposal()) {
remoteClientUnauthorized(ConfigManager.getInstance().getString("remoteClientHasNotCurrentProposalMessage") + " " + RemoteControlManager.getInstance().getInstrumentName(), true);
}
}
}
} else {
......
......@@ -159,7 +159,7 @@ public class NomadLite {
exit();
} else if (loginStatus == ServerConnection.LOGIN_REFUSED) {
} else if (loginStatus == ServerConnection.LOGIN_REFUSED_MULTIPLE_CLIENTS || loginStatus == ServerConnection.LOGIN_REFUSED_MULTIPLE_CONNECTIONS) {
System.out.println("Another client is already running. Login refused.");
} else {
......
......@@ -45,6 +45,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import fr.ill.ics.bridge.LoginManager.MultipleConnectionsPerUserNotAllowedException;
import fr.ill.ics.client.control.MainWindow;
import fr.ill.ics.client.control.experiment.Instrument;
import fr.ill.ics.client.control.login.ServerConnection;
......@@ -284,7 +285,11 @@ public class SWTStartupSplashDialog extends StartupSplashDialog {
DialogManager.getInstance().nomadMessageDialog("clientWrongLoginMessage", "clientWrongLoginTitle");
break;
case ServerConnection.LOGIN_REFUSED :
case ServerConnection.LOGIN_REFUSED_MULTIPLE_CLIENTS:
DialogManager.getInstance().nomadMessageDialog("clientAlreadyLaunchedMessage", "clientAlreadyLaunchedTitle");
splash.close();
throw new ExitException(0);
case ServerConnection.LOGIN_REFUSED_MULTIPLE_CONNECTIONS:
DialogManager.getInstance().nomadMessageDialog("clientAlreadyLaunchedMessage", "clientAlreadyLaunchedTitle");
splash.close();
throw new ExitException(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment