pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: Erik Wienhold <ewie@ewie.name>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to remove user specific grant and revoke
Date: Sun, 4 Jun 2023 01:08:46 +0300
Message-ID: <3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee> (raw)
In-Reply-To: <2751c0ad-1e40-2aa4-eab6-6d3e0f1ff6bd@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>

Hi!
>
> 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.

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?

Andrus.

view thread (12+ messages)  latest in thread

Message-ID: <3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee>
Permalink:  ../3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee/
Also on:    postgresql.org/message-id/3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee

 · 

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 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: kobruleht2@hot.ee, ewie@ewie.name
  Subject: Re: How to remove user specific grant and revoke
  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>

* 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