[Rt-commit] r7228 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Tue Mar 13 09:25:44 EDT 2007


Author: ruz
Date: Tue Mar 13 09:25:44 2007
New Revision: 7228

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Handle.pm

Log:
* localize *acl
* support for a file as argument as well as a dir

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Handle.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Handle.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Handle.pm	Tue Mar 13 09:25:44 2007
@@ -301,10 +301,21 @@
 
     return if $db_type eq 'SQLite';
 
-    # XXX: this is polluting acl()
-    do $base_path ."/acl.". $db_type
-        || die "Couldn't find ACLs for ". $db_type .": " . $@;
+    die "'$base_path' doesn't exist" unless -e $base_path;
 
+    my $path;
+    if ( -d $base_path ) {
+        $path = File::Spec->catfile( $base_path, "acl.$db_type");
+        $path = File::Spec->catfile( $base_path, "acl")
+            unless -e $path;
+        die "Couldn't find ACLs for $db_type"
+            unless -e $path;
+    } else {
+        $path = $base_path;
+    }
+
+    local *acl;
+    do $path || die "Couldn't load ACLs: " . $@;
     my @acl = acl($dbh);
     foreach my $statement (@acl) {
 #        print STDERR $statement if $args{'debug'};


More information about the Rt-commit mailing list