"Fossies" - the Fresh Open Source Software Archive

Member "RT-Extension-Assets-1.05/etc/acl.Pg" (24 May 2013, 723 Bytes) of package /linux/misc/RT-Extension-Assets-1.05.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 sub acl {
    2     my $dbh = shift;
    3 
    4     my @acls;
    5     my @tables = qw (
    6         rtxassets_id_seq
    7         RTxAssets
    8         rtxcatalogs_id_seq
    9         RTxCatalogs
   10     );
   11 
   12     my $db_user = RT->Config->Get('DatabaseUser');
   13 
   14     my $sequence_right
   15         = ( $dbh->{pg_server_version} >= 80200 )
   16         ? "USAGE, SELECT, UPDATE"
   17         : "SELECT, UPDATE";
   18 
   19     foreach my $table (@tables) {
   20         # Tables are upper-case, sequences are lowercase in @tables
   21         if ( $table =~ /^[a-z]/ ) {
   22             push @acls, "GRANT $sequence_right ON $table TO \"$db_user\";"
   23         }
   24         else {
   25             push @acls, "GRANT SELECT, INSERT, UPDATE, DELETE ON $table TO \"$db_user\";"
   26         }
   27     }
   28     return (@acls);
   29 }
   30 
   31 1;