Re: How to remove user specific grant and revoke

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Andrus <kobruleht2(at)hot(dot)ee>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to remove user specific grant and revoke
Date: 2023-06-03 13:07:52
Message-ID: 1408288797.797459.1685797672449@office.mailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 03/06/2023 14:46 CEST Erik Wienhold <ewie(at)ewie(dot)name> wrote:
>
> > On 03/06/2023 09:16 CEST Andrus <kobruleht2(at)hot(dot)ee> wrote:
> >
> > DROP REVOKE ALL ON TABLE public.kaspriv FROM all EXCEPT public;
> > DROP GRANT SELECT ON TABLE public.kaspriv FROM all EXCEPT public;
> >
> > This will be one-time action. It can be done manually in pgadmin or using
> > some script running once.
>
> Automate this with aclexplode[0] to get the privileges for specific grantees.
> Loop over the result set in a DO block, generate the REVOKE commands, and
> EXECUTE them.
>
> SELECT acl.grantee::regrole, acl.privilege_type
> FROM pg_class, aclexplode(relacl) acl
> WHERE oid = 'public.kaspriv'::regclass;

Or just execute those REVOKE ALL commands (except for PUBLIC) that pgAdmin
already gives you.

--
Erik

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-06-03 13:51:12 Re: pg_upgrade and schema complexity...
Previous Message Erik Wienhold 2023-06-03 12:46:16 Re: How to remove user specific grant and revoke