public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pradip Parkale <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Cc: Aditya Toshniwal <[email protected]>
Subject: Re: [pgAdmin][RM6448]: [search object] error displayed for non superuser because of right on pg_catalog.pg_subscription
Date: Mon, 19 Jul 2021 13:49:03 +0530
Message-ID: <CAJ9T6StsxuBgYBkK1T=yvHmgpEsd_N+He7EZHen+3jzGeTcdRg@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDdbgR=n09wfB37Azfy-FtrVxxEhud2JeOVtE9pafmfb9Q@mail.gmail.com>
References: <CAJ9T6SsKmtv8f4kXF=qdzXVWrV9EAB-QhOBFrZ80i0wNcNwRNg@mail.gmail.com>
	<[email protected]>
	<CAJ9T6SvJk6wW9qrGTURm+iGX=i5QzPoqQ=46950uFeu40AZdaQ@mail.gmail.com>
	<CANxoLDdbgR=n09wfB37Azfy-FtrVxxEhud2JeOVtE9pafmfb9Q@mail.gmail.com>

Hi Akshay,
Please find the updated patch.I have added a more reliable solution to
solve this issue.

On Wed, Jun 23, 2021 at 12:52 PM Akshay Joshi <[email protected]>
wrote:

> Thanks, the patch applied.
>
> On Tue, Jun 22, 2021 at 4:17 PM Pradip Parkale <
> [email protected]> wrote:
>
>> Hi Hackers,
>> Please ignore my previous email and find the attached patch. I have fixed
>> some review comments given by Aditya.
>>
>> On Tue, Jun 22, 2021 at 2:21 PM Fred <[email protected]> wrote:
>>
>>> nice !
>>> thanks
>>>
>>> fred
>>>
>>>
>>> Le 22 juin 2021 09:08:05 GMT+02:00, Pradip Parkale <
>>> [email protected]> a écrit :
>>>>
>>>> Hi Hackers,
>>>>
>>>> Please find the attached patch for # 6448. I have added a check to
>>>> ignore the subscription when the search type is 'All type' if the user
>>>> doesn't have access to subscription.
>>>>
>>>> --
>>>> Thanks & Regards,
>>>> Pradip Parkale
>>>> Software Engineer | EnterpriseDB Corporation
>>>>
>>>
>>
>> --
>> Thanks & Regards,
>> Pradip Parkale
>> Software Engineer | EnterpriseDB Corporation
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] RM6448_v2.patch (871B, 3-RM6448_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/tools/search_objects/utils.py b/web/pgadmin/tools/search_objects/utils.py
index 407dc83f2..16cfefcd9 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, error = conn.execute_dict(
+                "SELECT COUNT(1) FROM information_schema.table_privileges  "
+                "WHERE table_name = 'pg_subscription' "
+                "AND privilege_type = 'SELECT'")
+            if 'count' in error['rows'][0] and \
+                    error['rows'][0]['count'] == '0':
                 skip_obj_type.append('subscription')
 
         return skip_obj_type


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [pgAdmin][RM6448]: [search object] error displayed for non superuser because of right on pg_catalog.pg_subscription
  In-Reply-To: <CAJ9T6StsxuBgYBkK1T=yvHmgpEsd_N+He7EZHen+3jzGeTcdRg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox