mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that the user should be able to kill the session from Dashboard if the user has a 'pg_signal_backend' role. Fixes #6159
This commit is contained in:
parent
f77fceb1b2
commit
8279e7e01c
@ -11,6 +11,7 @@ notes for it.
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
|
release_notes_5_1
|
||||||
release_notes_5_0
|
release_notes_5_0
|
||||||
release_notes_4_30
|
release_notes_4_30
|
||||||
release_notes_4_29
|
release_notes_4_29
|
||||||
|
20
docs/en_US/release_notes_5_1.rst
Normal file
20
docs/en_US/release_notes_5_1.rst
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
************
|
||||||
|
Version 5.1
|
||||||
|
************
|
||||||
|
|
||||||
|
Release date: 2021-03-25
|
||||||
|
|
||||||
|
This release contains a number of bug fixes and new features since the release of pgAdmin4 5.0.
|
||||||
|
|
||||||
|
New features
|
||||||
|
************
|
||||||
|
|
||||||
|
|
||||||
|
Housekeeping
|
||||||
|
************
|
||||||
|
|
||||||
|
|
||||||
|
Bug fixes
|
||||||
|
*********
|
||||||
|
|
||||||
|
| `Issue #6159 <https://redmine.postgresql.org/issues/6159>`_ - Ensure that the user should be able to kill the session from Dashboard if the user has a 'pg_signal_backend' role.
|
@ -30,7 +30,8 @@ define('pgadmin.dashboard', [
|
|||||||
is_super_user = false,
|
is_super_user = false,
|
||||||
current_user, maintenance_database,
|
current_user, maintenance_database,
|
||||||
is_server_dashboard = false,
|
is_server_dashboard = false,
|
||||||
is_database_dashboard = false;
|
is_database_dashboard = false,
|
||||||
|
can_signal_backend = false;
|
||||||
|
|
||||||
// Custom BackGrid cell, Responsible for cancelling active sessions
|
// Custom BackGrid cell, Responsible for cancelling active sessions
|
||||||
var customDashboardActionCell = Backgrid.Extension.DeleteCell.extend({
|
var customDashboardActionCell = Backgrid.Extension.DeleteCell.extend({
|
||||||
@ -293,6 +294,7 @@ define('pgadmin.dashboard', [
|
|||||||
// Check if user is super user
|
// Check if user is super user
|
||||||
var server = treeHierarchy['server'];
|
var server = treeHierarchy['server'];
|
||||||
maintenance_database = (server && server.db) || null;
|
maintenance_database = (server && server.db) || null;
|
||||||
|
can_signal_backend = server.user.can_signal_backend;
|
||||||
|
|
||||||
if (server && server.user && server.user.is_superuser) {
|
if (server && server.user && server.user.is_superuser) {
|
||||||
is_super_user = true;
|
is_super_user = true;
|
||||||
@ -1149,6 +1151,9 @@ define('pgadmin.dashboard', [
|
|||||||
gettext('The session is already in idle state.')
|
gettext('The session is already in idle state.')
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
|
} else if (can_signal_backend) {
|
||||||
|
// user with membership of 'pg_signal_backend' can terminate the session of non admin user.
|
||||||
|
return true;
|
||||||
} else if (is_super_user) {
|
} else if (is_super_user) {
|
||||||
// Super user can do anything
|
// Super user can do anything
|
||||||
return true;
|
return true;
|
||||||
|
@ -552,12 +552,20 @@ WHERE db.datname = current_database()""")
|
|||||||
"""
|
"""
|
||||||
status = self._execute(cur, """
|
status = self._execute(cur, """
|
||||||
SELECT
|
SELECT
|
||||||
oid as id, rolname as name, rolsuper as is_superuser,
|
roles.oid as id, roles.rolname as name,
|
||||||
CASE WHEN rolsuper THEN true ELSE rolcreaterole END as
|
roles.rolsuper as is_superuser,
|
||||||
|
CASE WHEN roles.rolsuper THEN true ELSE roles.rolcreaterole END as
|
||||||
can_create_role,
|
can_create_role,
|
||||||
CASE WHEN rolsuper THEN true ELSE rolcreatedb END as can_create_db
|
CASE WHEN roles.rolsuper THEN true
|
||||||
|
ELSE roles.rolcreatedb END as can_create_db,
|
||||||
|
CASE WHEN 'pg_signal_backend'=ANY(ARRAY(
|
||||||
|
SELECT pg_catalog.pg_roles.rolname FROM
|
||||||
|
pg_catalog.pg_auth_members m JOIN pg_catalog.pg_roles ON
|
||||||
|
(m.roleid = pg_catalog.pg_roles.oid) WHERE
|
||||||
|
m.member = roles.oid)) THEN True
|
||||||
|
ELSE False END as can_signal_backend
|
||||||
FROM
|
FROM
|
||||||
pg_catalog.pg_roles
|
pg_catalog.pg_roles as roles
|
||||||
WHERE
|
WHERE
|
||||||
rolname = current_user""")
|
rolname = current_user""")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user