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:
committed by
Akshay Joshi
parent
f77fceb1b2
commit
8279e7e01c
@@ -30,7 +30,8 @@ define('pgadmin.dashboard', [
|
||||
is_super_user = false,
|
||||
current_user, maintenance_database,
|
||||
is_server_dashboard = false,
|
||||
is_database_dashboard = false;
|
||||
is_database_dashboard = false,
|
||||
can_signal_backend = false;
|
||||
|
||||
// Custom BackGrid cell, Responsible for cancelling active sessions
|
||||
var customDashboardActionCell = Backgrid.Extension.DeleteCell.extend({
|
||||
@@ -293,6 +294,7 @@ define('pgadmin.dashboard', [
|
||||
// Check if user is super user
|
||||
var server = treeHierarchy['server'];
|
||||
maintenance_database = (server && server.db) || null;
|
||||
can_signal_backend = server.user.can_signal_backend;
|
||||
|
||||
if (server && server.user && server.user.is_superuser) {
|
||||
is_super_user = true;
|
||||
@@ -1149,6 +1151,9 @@ define('pgadmin.dashboard', [
|
||||
gettext('The session is already in idle state.')
|
||||
);
|
||||
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) {
|
||||
// Super user can do anything
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user