Re: How to remove user specific grant and revoke

Andrus <kobruleht2@hot.ee>

From: Andrus <kobruleht2@hot.ee>
To: Erik Wienhold <ewie@ewie.name>, pgsql-general <pgsql-general@postgresql.org>
Date: 2023-06-03T21:34:32Z
Lists: pgsql-general
Hi!


>> After this command pgAdmin still shows revoke and grant commands for
>> alekspoluh role.
>> How to remove all grant and revoke assignments for role ?
> Please confirm that \dp public.kaspriv no longer shows an ACL for alekspoluh
> after running:
>
> 	REVOKE ALL ON public.kaspriv FROM alekspoluh;
psql (12.2 (Debian 12.2-2.pgdg100+1))
Type "help" for help.

sba=# REVOKE ALL ON public.kaspriv FROM alekspoluh;
REVOKE
sba=# \o result.txt
sba=#  \dp public.kaspriv

sba=# \q

#grep alekspoluh result.txt

Returns nothing. So output does not contain this role.

> There must be something wrong with pgAdmin if it still shows REVOKE ALL for
> that role after its ACL is gone.  Looking at the code, pgAdmin emits REVOKE ALL
> for any grantee it find in the ACL.
>
> https://github.com/pgadmin-org/pgadmin4/blob/REL-7_2/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py#L712

I re-opened pgadmin.  alekspoluh role is no more displayed in kaspriv 
table sql window.

pgadmin shows only single reset role command. Now it shows

REVOKE ALL ON TABLE public.kaspriv FROM yllelohmus;

I ran

REVOKE ALL ON TABLE public.kaspriv FROM yllelohmus;

After that pgadmin shows next single revoke command:

REVOKE ALL ON TABLE public.kaspriv FROM villuuus;

It looks like pgAdmin shows only one REVOKE command but actually there 
are more revokes.

Should I ran separate revoke commands for every user to remove those 
revokes ?

pgAdmin also shows about 100 grant commands for users like

GRANT SELECT ON TABLE public.kaspriv TO paide;

How to remove user-spefic grants ?

Andrus.