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

@ -18,4 +18,5 @@ Bug fixes
*********
| `Issue #6369 <https://redmine.postgresql.org/issues/6369>`_ - Fixed CSRF errors for stale sessions by increasing the session expiration time for desktop mode.
| `Issue #6448 <https://redmine.postgresql.org/issues/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 <https://redmine.postgresql.org/issues/6580>`_ - Fixed TypeError 'NoneType' object is not sub scriptable.

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