Allow grant-level control of role inheritance behavior.
authorRobert Haas <rhaas@postgresql.org>
Thu, 25 Aug 2022 14:06:02 +0000 (10:06 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 25 Aug 2022 14:06:02 +0000 (10:06 -0400)
commite3ce2de09d814f8770b2e3b3c152b7671bcdb83f
tree1ca5cf6da0ce86056ad4e573231a44ff651e252d
parent2059c5e3b06545e7d0650dba9c665332374c3c21
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
15 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/ref/create_role.sgml
doc/src/sgml/ref/grant.sgml
doc/src/sgml/ref/revoke.sgml
src/backend/commands/user.c
src/backend/parser/gram.y
src/backend/tcop/utility.c
src/backend/utils/adt/acl.c
src/bin/pg_dump/pg_dumpall.c
src/include/catalog/catversion.h
src/include/catalog/pg_auth_members.h
src/include/commands/user.h
src/include/nodes/parsenodes.h
src/test/regress/expected/privileges.out
src/test/regress/sql/privileges.sql