From d2a4464f6ef54972ca89c86fed2b34fc5e4b8b26 Mon Sep 17 00:00:00 2001 From: Mikel Eguiraun Date: Mon, 26 Aug 2024 14:38:53 +0200 Subject: [PATCH 1/4] do not create session for all users proposals remove commented code --- mxcubeweb/core/components/lims.py | 6 +----- mxcubeweb/core/components/user/usermanager.py | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/mxcubeweb/core/components/lims.py b/mxcubeweb/core/components/lims.py index 29157a755..cf75dce20 100644 --- a/mxcubeweb/core/components/lims.py +++ b/mxcubeweb/core/components/lims.py @@ -226,10 +226,6 @@ def lims_login(self, loginID, password, create_session): ) return ERROR_CODE - for prop in session["proposal_list"]: - todays_session = HWR.beamline.lims.get_todays_session(prop) - prop["Session"] = [todays_session["session"]] - if hasattr( HWR.beamline.session, "commissioning_fake_proposal" ) and HWR.beamline.session.is_inhouse(loginID, None): @@ -326,7 +322,7 @@ def select_proposal(self, proposal): ) todays_session = HWR.beamline.lims.get_todays_session( - proposal_info, create_session=False + proposal_info, create_session=True ) HWR.beamline.session.session_id = todays_session.get("session").get( "sessionId" diff --git a/mxcubeweb/core/components/user/usermanager.py b/mxcubeweb/core/components/user/usermanager.py index e04133f5a..76454e2c1 100644 --- a/mxcubeweb/core/components/user/usermanager.py +++ b/mxcubeweb/core/components/user/usermanager.py @@ -384,9 +384,6 @@ def _login(self, login_id: str, password: str): # Only allow remote logins with existing sessions if self.app.lims.lims_valid_login(login_res) and is_local_host(): - if not self.app.lims.lims_existing_session(login_res): - login_res = self.app.lims.create_lims_session(login_res) - msg = "[LOGIN] Valid login from local host (%s)" % str(info) logging.getLogger("MX3.HWR").info(msg) elif self.app.lims.lims_valid_login( From 7df3ad8217a5f0c62fe23efc6956df99d1699d1d Mon Sep 17 00:00:00 2001 From: meguiraun Date: Mon, 2 Sep 2024 11:29:53 +0200 Subject: [PATCH 2/4] Update mxcubeweb/core/components/user/usermanager.py Co-authored-by: Marcus Oscarsson --- mxcubeweb/core/components/user/usermanager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mxcubeweb/core/components/user/usermanager.py b/mxcubeweb/core/components/user/usermanager.py index 76454e2c1..50b9b57ad 100644 --- a/mxcubeweb/core/components/user/usermanager.py +++ b/mxcubeweb/core/components/user/usermanager.py @@ -383,7 +383,9 @@ def _login(self, login_id: str, password: str): raise Exception("Remote access disabled") # Only allow remote logins with existing sessions - if self.app.lims.lims_valid_login(login_res) and is_local_host(): + if self.app.lims.lims_valid_login(login_res) + and is_local_host() + and HWR.beamline.lims.loginType.lower() != "user": msg = "[LOGIN] Valid login from local host (%s)" % str(info) logging.getLogger("MX3.HWR").info(msg) elif self.app.lims.lims_valid_login( From a8e938ab56958d3a5f29e1c3b0c3e0425b5538d9 Mon Sep 17 00:00:00 2001 From: meguiraun Date: Mon, 2 Sep 2024 12:10:59 +0200 Subject: [PATCH 3/4] Update mxcubeweb/core/components/user/usermanager.py Co-authored-by: Marcus Oscarsson --- mxcubeweb/core/components/user/usermanager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mxcubeweb/core/components/user/usermanager.py b/mxcubeweb/core/components/user/usermanager.py index 50b9b57ad..301da2006 100644 --- a/mxcubeweb/core/components/user/usermanager.py +++ b/mxcubeweb/core/components/user/usermanager.py @@ -383,7 +383,11 @@ def _login(self, login_id: str, password: str): raise Exception("Remote access disabled") # Only allow remote logins with existing sessions - if self.app.lims.lims_valid_login(login_res) + if ( + self.app.lims.lims_valid_login(login_res) + and is_local_host() + and HWR.beamline.lims.loginType.lower() != "user" + ): and is_local_host() and HWR.beamline.lims.loginType.lower() != "user": msg = "[LOGIN] Valid login from local host (%s)" % str(info) From e5efd4e31cf6fe03d59e8716b5fbcb45dbfef53b Mon Sep 17 00:00:00 2001 From: Marcus Oscarsson Date: Mon, 2 Sep 2024 15:29:48 +0200 Subject: [PATCH 4/4] Update mxcubeweb/core/components/user/usermanager.py --- mxcubeweb/core/components/user/usermanager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mxcubeweb/core/components/user/usermanager.py b/mxcubeweb/core/components/user/usermanager.py index 301da2006..ad6767f5d 100644 --- a/mxcubeweb/core/components/user/usermanager.py +++ b/mxcubeweb/core/components/user/usermanager.py @@ -388,7 +388,6 @@ def _login(self, login_id: str, password: str): and is_local_host() and HWR.beamline.lims.loginType.lower() != "user" ): - and is_local_host() and HWR.beamline.lims.loginType.lower() != "user": msg = "[LOGIN] Valid login from local host (%s)" % str(info) logging.getLogger("MX3.HWR").info(msg)