Compare commits

...

2 Commits

Author SHA1 Message Date
Jere Vaara
d6c661ccb6 add missing string to format 2024-10-11 09:20:46 +03:00
David Gomes
0abf0f6dce quick test 2024-10-11 07:48:45 +02:00

View File

@@ -318,12 +318,26 @@ pub fn handle_roles(spec: &ComputeSpec, client: &mut Client) -> Result<()> {
"CREATE ROLE {} INHERIT CREATEROLE CREATEDB BYPASSRLS REPLICATION IN ROLE neon_superuser",
name.pg_quote()
);
// If the role we're creating is intended for JWT login, we do
// not give it any attributes.
if jwks_roles.contains(name.as_str()) {
query = format!("CREATE ROLE {}", name.pg_quote());
}
info!("running role create query: '{}'", &query);
query.push_str(&role.to_pg_options());
xact.execute(query.as_str(), &[])?;
// If the role we're creating is intended for JWT login, we have
// to make sure it can execute functions in the auth schema.
if jwks_roles.contains(name.as_str()) {
let mut grant_query = format!(
"GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA auth TO {}",
name.pg_quote()
);
info!("running grant query for JWT role: '{}'", &grant_query);
grant_query.push_str(&role.to_pg_options());
xact.execute(grant_query.as_str(), &[])?;
}
}
}