pgsql: Allow grant-level control of role inheritance behavior.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow grant-level control of role inheritance behavior.
Date: 2022-08-25 14:18:05
Message-ID: E1oRDgK-0019cI-10@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow grant-level control of role inheritance behavior.

The GRANT statement can now specify WITH INHERIT TRUE or WITH
INHERIT FALSE to control whether the member inherits the granted
role's permissions. For symmetry, you can now likewise write
WITH ADMIN TRUE or WITH ADMIN FALSE to turn ADMIN OPTION on or off.

If a GRANT does not specify WITH INHERIT, the behavior based on
whether the member role is marked INHERIT or NOINHERIT. This means
that if all roles are marked INHERIT or NOINHERIT before any role
grants are performed, the behavior is identical to what we had before;
otherwise, it's different, because ALTER ROLE [NO]INHERIT now only
changes the default behavior of future grants, and has no effect on
existing ones.

Patch by me. Reviewed and testing by Nathan Bossart and Tushar Ahuja,
with design-level comments from various others.

Discussion: http://postgr.es/m/CA+Tgmoa5Sf4PiWrfxA=sGzDKg0Ojo3dADw=wAHOhR9dggV=RmQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e3ce2de09d814f8770b2e3b3c152b7671bcdb83f

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 10 ++
doc/src/sgml/ref/create_role.sgml | 29 ++--
doc/src/sgml/ref/grant.sgml | 26 ++-
doc/src/sgml/ref/revoke.sgml | 9 +-
src/backend/commands/user.c | 262 +++++++++++++++++++++++++------
src/backend/parser/gram.y | 49 ++++--
src/backend/tcop/utility.c | 2 +-
src/backend/utils/adt/acl.c | 47 ++----
src/bin/pg_dump/pg_dumpall.c | 32 +++-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_auth_members.h | 1 +
src/include/commands/user.h | 2 +-
src/include/nodes/parsenodes.h | 2 +-
src/test/regress/expected/privileges.out | 14 +-
src/test/regress/sql/privileges.sql | 13 +-
15 files changed, 385 insertions(+), 115 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2022-08-25 14:36:08 pgsql: More -Wshadow=compatible-local warning fixes
Previous Message Peter Eisentraut 2022-08-25 13:11:47 pgsql: Move NON_EXEC_STATIC from c.h to postgres.h