Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

From: Harshal Dhumal <harshal(dot)dhumal(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires
Date: 2018-01-05 07:50:37
Message-ID: CAFiP3vy6fSp32kLkLEro=usmF2puF4ZudZDRXRykyo3_5PEo9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Further details:

1. If session is expired and user performs any action from sqleditor that
makes ajax call
then in ajax error call back user can check and handle login related error
using code snippet.

if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
return pgAdmin.Browser.UserManagement.pga_login();
}

Where is xhr is standard xhr or jqxhr object.

2. Similarly for connection lost (only maintenance db connection as we can
recover or reconnect other
connections if maintenance db connection is alive). It will attempt to
create/reconnect connection without
asking password (to handle passwordless connection, or saveed password or
password from pgpass file)
If connection to database still fails then it'll prompt for password.

Code snippet:
SqlEditorController.handle_connection_lost();
once connection lost is detected one can call handle_connection_lost() to
reconnect.

3. We maintain some additional data in session to maintain affinity between
each sqleditor/datagrid instance to backend database connection. However if
session expires and user
re-loggins then we need to first restore affinity between sqleditor to
backend database before we can start
using query tool.

Code snippet:

if(is_new_transaction_required(xhr)) {
SqlEditorController.init_transaction();
}

--
*Harshal Dhumal*
*Sr. Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Jan 5, 2018 at 11:44 AM, Harshal Dhumal <
harshal(dot)dhumal(at)enterprisedb(dot)com> wrote:

> Hi,
>
> Plz find attached patch to fix session expired issue
> from sqleditor/datadrid.
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Murtuza Zabuawala 2018-01-05 08:49:59 Re: [pgAdmin4][Patch]: Adding connection status in Query tool
Previous Message Harshal Dhumal 2018-01-05 06:14:50 RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires