summaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/guc_tables.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2023-01-10 12:44:49 -0500
committerRobert Haas <rhaas@postgresql.org>2023-01-10 12:44:49 -0500
commite5b8a4c098ad6add39626a14475148872cd687e0 (patch)
tree772094cf3bba3340bfa13afee99a30d24430927c /src/backend/utils/misc/guc_tables.c
parentcf5eb37c5ee0cc54c80d95c1695d7fca1f7c68cb (diff)
Add new GUC createrole_self_grant.
Can be set to the empty string, or to either or both of "set" or "inherit". If set to a non-empty value, a non-superuser who creates a role (necessarily by relying up the CREATEROLE privilege) will grant that role back to themselves with the specified options. This isn't a security feature, because the grant that this feature triggers can also be performed explicitly. Instead, it's a user experience feature. A superuser would necessarily inherit the privileges of any created role and be able to access all such roles via SET ROLE; with this patch, you can configure createrole_self_grant = 'set, inherit' to provide a similar experience for a user who has CREATEROLE but not SUPERUSER. Discussion: https://postgr.es/m/CA+TgmobN59ct+Emmz6ig1Nua2Q-_o=r6DSD98KfU53kctq_kQw@mail.gmail.com
Diffstat (limited to 'src/backend/utils/misc/guc_tables.c')
-rw-r--r--src/backend/utils/misc/guc_tables.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 92545b49587..5025e80f89d 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3950,6 +3950,18 @@ struct config_string ConfigureNamesString[] =
},
{
+ {"createrole_self_grant", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets whether a CREATEROLE user automatically grants "
+ "the role to themselves, and with which options."),
+ NULL,
+ GUC_LIST_INPUT
+ },
+ &createrole_self_grant,
+ "",
+ check_createrole_self_grant, assign_createrole_self_grant, NULL
+ },
+
+ {
{"dynamic_library_path", PGC_SUSET, CLIENT_CONN_OTHER,
gettext_noop("Sets the path for dynamically loadable modules."),
gettext_noop("If a dynamically loadable module needs to be opened and "