From: Erik Wienhold <ewie@ewie.name>
To: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to remove user specific grant and revoke
Date: Sun, 4 Jun 2023 02:36:32 +0200 (CEST)
Message-ID: <1147003960.809525.1685838992758@office.mailbox.org> (raw)
In-Reply-To: <3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee>
References: <568e6761-d224-7c72-59f3-267b39bde227@hot.ee>
<2140448238.796716.1685796376553@office.mailbox.org>
<1408288797.797459.1685797672449@office.mailbox.org>
<c832dd7d-743e-f77f-e07b-8fbccfb059f4@hot.ee>
<371357275.803438.1685810290820@office.mailbox.org>
<cc2dc8b5-ba7d-7652-31f1-4038f778244f@hot.ee>
<872810576.804014.1685813147131@office.mailbox.org>
<b35dbd8f-9896-9708-08a8-5a1747c0ece3@hot.ee>
<c8a918fa-3f8a-0ddd-12a9-85d8b24f3e22@hot.ee>
<666755787.808219.1685825876788@office.mailbox.org>
<2751c0ad-1e40-2aa4-eab6-6d3e0f1ff6bd@hot.ee>
<3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee>
> On 04/06/2023 00:08 CEST Andrus <kobruleht2@hot.ee> wrote:
>
> > Should I ran separate revoke commands for every user to remove those
> > revokes ?
> > How to remove user-spefic grants ?
> After running revoke commands in psql, GRANT commands disappeared magically.
> It looks like pgAdmin does not allow execute REVOKO commands.
I don't think so. There's nothing special about REVOKE that pgAdmin may
disallow.
> After running script which adds user group tabel modification rights for
> admin users:
> CREATE POLICY kaspriv_sel_policy ON kaspriv FOR SELECT USING (true);
> CREATE POLICY kaspriv_mod_policy ON kaspriv USING (
> lower(kasutaja)= current_user OR kasutaja in
> ( select kasutaja from kasutaja where ','||firmad||','
> LIKE '%,'|| (select firmad from kasutaja where lower(kasutaja)= current_user) || ',%'
> )
> );
> ALTER TABLE kaspriv ENABLE ROW LEVEL SECURITY;
> revoke all on kaspriv from public;
> grant select on kaspriv to public;
> grant insert, update, delete on kaspriv to admin1, admin2;
>
> pgAdmin shows revoke commands for those users:
> REVOKE ALL ON TABLE public.kaspriv FROM admin1;
> REVOKE ALL ON TABLE public.kaspriv FROM admin2;
> How to prevent pgAdmin to show those revokes?
pgAdmin includes the REVOKE commands so that roles will only get the privileges
listed in the subsequent GRANT commands when executing that script. This makes
sure that the script will reproduce the current privileges regardless of what
may be granted at some later point (in case of an already existing table and
CREATE TABLE IF NOT EXISTS is used) and regardless of any default privileges
that may be defined when creating a new table.
--
Erik
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ewie@ewie.name, kobruleht2@hot.ee
Subject: Re: How to remove user specific grant and revoke
In-Reply-To: <1147003960.809525.1685838992758@office.mailbox.org>
References: <568e6761-d224-7c72-59f3-267b39bde227@hot.ee> <2140448238.796716.1685796376553@office.mailbox.org> <1408288797.797459.1685797672449@office.mailbox.org> <c832dd7d-743e-f77f-e07b-8fbccfb059f4@hot.ee> <371357275.803438.1685810290820@office.mailbox.org> <cc2dc8b5-ba7d-7652-31f1-4038f778244f@hot.ee> <872810576.804014.1685813147131@office.mailbox.org> <b35dbd8f-9896-9708-08a8-5a1747c0ece3@hot.ee> <c8a918fa-3f8a-0ddd-12a9-85d8b24f3e22@hot.ee> <666755787.808219.1685825876788@office.mailbox.org> <2751c0ad-1e40-2aa4-eab6-6d3e0f1ff6bd@hot.ee> <3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee> <1147003960.809525.1685838992758@office.mailbox.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox