Skip to content

Commit

Permalink
add parameter with_admin_option
Browse files Browse the repository at this point in the history
  • Loading branch information
vaol committed Oct 13, 2024
1 parent e8c1db2 commit 2d652f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion manifests/server/grant_role.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# @param psql_user Sets the OS user to run psql.
# @param port Port to use when connecting.
# @param connect_settings Specifies a hash of environment variables used when connecting to a remote server.
# @param with_admin_option Specifies if the role should be granted with admin option.
define postgresql::server::grant_role (
String[1] $group,
String[1] $role = $name,
Expand All @@ -15,10 +16,12 @@
$psql_user = $postgresql::server::user,
$port = $postgresql::server::port,
$connect_settings = $postgresql::server::default_connect_settings,
$with_admin_option = false,
) {
case $ensure {
'present': {
$command = "GRANT \"${group}\" TO \"${role}\""
$with_admin_option_sql = $with_admin_option ? { true => 'WITH ADMIN OPTION', default => '' }
$command = "GRANT \"${group}\" TO \"${role}\" ${with_admin_option_sql}"
$unless_comp = '='
}
'absent': {
Expand Down

0 comments on commit 2d652f7

Please sign in to comment.