Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q5bjd-0000bj-8b for pgsql-general@arkaria.postgresql.org; Sun, 04 Jun 2023 00:36:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q5bjc-0008Sc-65 for pgsql-general@arkaria.postgresql.org; Sun, 04 Jun 2023 00:36:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q5bjb-0008SQ-S3 for pgsql-general@lists.postgresql.org; Sun, 04 Jun 2023 00:36:39 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q5bjZ-0003kp-Di for pgsql-general@postgresql.org; Sun, 04 Jun 2023 00:36:38 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4QYd8d0rdFz9skC; Sun, 4 Jun 2023 02:36:33 +0200 (CEST) Date: Sun, 4 Jun 2023 02:36:32 +0200 (CEST) From: Erik Wienhold To: Andrus , pgsql-general Message-ID: <1147003960.809525.1685838992758@office.mailbox.org> 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> <371357275.803438.1685810290820@office.mailbox.org> <872810576.804014.1685813147131@office.mailbox.org> <666755787.808219.1685825876788@office.mailbox.org> <2751c0ad-1e40-2aa4-eab6-6d3e0f1ff6bd@hot.ee> <3d59b000-0964-4a32-faab-ea8a3adf10b8@hot.ee> Subject: Re: How to remove user specific grant and revoke MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 04/06/2023 00:08 CEST Andrus 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