Ensure that the user should be able to drop the database even if it is connected. Fixes #5722

This commit is contained in:
Pradip Parkale
2020-08-25 12:37:50 +05:30
committed by Akshay Joshi
parent b3d49c61a5
commit 86bbc3a9e8
2 changed files with 12 additions and 0 deletions

View File

@@ -872,6 +872,17 @@ class DatabaseView(PGChildNodeView):
)
)
else:
if self.conn.connected():
# Release the connection if it is connected
from pgadmin.utils.driver import get_driver
manager = \
get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
manager.connection(did=did, auto_reconnect=True)
status = manager.release(did=did)
if not status:
return unauthorized(
_("Database could not be deleted."))
SQL = render_template(
"/".join([self.template_path, self._DELETE_SQL]),