From b2205fc6e178638dff9062e9b6c469c207b5e688 Mon Sep 17 00:00:00 2001 From: Pradip Parkale Date: Mon, 19 Jul 2021 14:11:10 +0530 Subject: [PATCH] Fixed an issue in the search object when searching in 'all types' or 'subscription' if the user doesn't have access to the subscription. Fixes #6448 --- docs/en_US/release_notes_5_6.rst | 1 + web/pgadmin/tools/search_objects/utils.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/en_US/release_notes_5_6.rst b/docs/en_US/release_notes_5_6.rst index 836429953..28eb94a9f 100644 --- a/docs/en_US/release_notes_5_6.rst +++ b/docs/en_US/release_notes_5_6.rst @@ -18,4 +18,5 @@ Bug fixes ********* | `Issue #6369 `_ - Fixed CSRF errors for stale sessions by increasing the session expiration time for desktop mode. +| `Issue #6448 `_ - Fixed an issue in the search object when searching in 'all types' or 'subscription' if the user doesn't have access to the subscription. | `Issue #6580 `_ - Fixed TypeError 'NoneType' object is not sub scriptable. diff --git a/web/pgadmin/tools/search_objects/utils.py b/web/pgadmin/tools/search_objects/utils.py index 407dc83f2..1f191779e 100644 --- a/web/pgadmin/tools/search_objects/utils.py +++ b/web/pgadmin/tools/search_objects/utils.py @@ -98,8 +98,12 @@ class SearchObjectsHelper: """ if obj_type == 'all': - status, error = conn.execute_dict('select * from pg_subscription') - if 'permission denied' in error: + status, result = conn.execute_dict( + "SELECT COUNT(1) FROM information_schema.table_privileges " + "WHERE table_name = 'pg_subscription' " + "AND privilege_type = 'SELECT'") + if 'count' in result['rows'][0] and \ + result['rows'][0]['count'] == '0': skip_obj_type.append('subscription') return skip_obj_type