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

This commit is contained in:
Pradip Parkale
2021-07-19 14:11:10 +05:30
committed by Akshay Joshi
parent 5768ade198
commit b2205fc6e1
2 changed files with 7 additions and 2 deletions

View File

@@ -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