diff options
Diffstat (limited to 'rt/etc/upgrade/4.1.1/acl.Pg')
-rw-r--r-- | rt/etc/upgrade/4.1.1/acl.Pg | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/rt/etc/upgrade/4.1.1/acl.Pg b/rt/etc/upgrade/4.1.1/acl.Pg new file mode 100644 index 0000000..9e8fc0a --- /dev/null +++ b/rt/etc/upgrade/4.1.1/acl.Pg @@ -0,0 +1,31 @@ + +sub acl { + my $dbh = shift; + + my @acls; + + my @tables = qw ( + objectscrips_id_seq + ObjectScrips + ); + + my $db_user = RT->Config->Get('DatabaseUser'); + + my $sequence_right + = ( $dbh->{pg_server_version} >= 80200 ) + ? "USAGE, SELECT, UPDATE" + : "SELECT, UPDATE"; + + foreach my $table (@tables) { + # Tables are upper-case, sequences are lowercase in @tables + if ( $table =~ /^[a-z]/ ) { + push @acls, "GRANT $sequence_right ON $table TO \"$db_user\";" + } + else { + push @acls, "GRANT SELECT, INSERT, UPDATE, DELETE ON $table TO \"$db_user\";" + } + } + return (@acls); +} + +1; |