]> git.uio.no Git - usit-rt.git/blob - etc/acl.mysql
Master to 4.2.8
[usit-rt.git] / etc / acl.mysql
1
2 sub acl {
3     my $db_name = RT->Config->Get('DatabaseName');
4     my $db_rthost = RT->Config->Get('DatabaseRTHost');
5     my $db_user = RT->Config->Get('DatabaseUser');
6     my $db_pass = RT->Config->Get('DatabasePassword');
7     unless ( $db_user ) {
8         RT->Logger->warn("DatabaseUser option is not defined or empty. Skipping...");
9         return;
10     }
11     if ( $db_user eq 'root' ) {
12         RT->Logger->warn("DatabaseUser is root. Skipping...");
13         return;
14     }
15     $db_name =~ s/([_%])/\\$1/g;
16     return (
17         "GRANT SELECT,INSERT,CREATE,INDEX,UPDATE,DELETE
18                ON `$db_name`.*
19                TO '$db_user'\@'$db_rthost'
20                IDENTIFIED BY '$db_pass';",
21     );
22 }
23
24 1;