diff options
author | ivan <ivan> | 2012-02-19 22:45:24 +0000 |
---|---|---|
committer | ivan <ivan> | 2012-02-19 22:45:24 +0000 |
commit | 5a5e999c1995dc74e90a5bec660e28692b81611e (patch) | |
tree | 872956f7ec1b3026d1c1bdb5f923aed96429225b /rt/etc/acl.mysql | |
parent | 2c4e5aea8e1833e000716706d2a08ac9fdabf934 (diff) |
fix ancient vendor branch CVS bs
Diffstat (limited to 'rt/etc/acl.mysql')
-rwxr-xr-x | rt/etc/acl.mysql | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/rt/etc/acl.mysql b/rt/etc/acl.mysql index 0ecaa3b15..16882378e 100755 --- a/rt/etc/acl.mysql +++ b/rt/etc/acl.mysql @@ -1,8 +1,25 @@ + sub acl { -return ( -"USE mysql;", -"DELETE FROM user WHERE user = '${RT::DatabaseUser}';", -"DELETE FROM db where db = '${RT::DatabaseName}';", -"GRANT SELECT,INSERT,CREATE,INDEX,UPDATE,DELETE ON ${RT::DatabaseName}.* TO ${RT::DatabaseUser}\@${RT::DatabaseRTHost} IDENTIFIED BY '${RT::DatabasePassword}';"); + my $db_name = RT->Config->Get('DatabaseName'); + my $db_rthost = RT->Config->Get('DatabaseRTHost'); + my $db_user = RT->Config->Get('DatabaseUser'); + my $db_pass = RT->Config->Get('DatabasePassword'); + unless ( $db_user ) { + print STDERR "DatabaseUser option is not defined or empty. Skipping...\n"; + return; + } + if ( $db_user eq 'root' ) { + print STDERR "DatabaseUser is root. Skipping...\n"; + return; + } + print "Granting access to $db_user\@'$db_rthost' on $db_name.\n"; + $db_name =~ s/([_%])/\\$1/g; + return ( + "GRANT SELECT,INSERT,CREATE,INDEX,UPDATE,DELETE + ON `$db_name`.* + TO '$db_user'\@'$db_rthost' + IDENTIFIED BY '$db_pass';", + ); } + 1; |