1

I'm trying to complete Redmine's feature request #2693: Use Redmine.pm to authenticate for any directory (1). I have not much knowledge on all these things and need help. Redmine uses mod_perl module Redmine.pm for authentication & authorization. This module defines several custom configuration directives. I've successfully modified patch from (1) and it works when all config is in <Location>:

<Location /digischrank/test>
        AuthType basic
        AuthName "Digischrank Test" 
        Require valid-user
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        RedmineDSN "DBI:mysql:database=SomedaTaBAse;host=localhost" 
        RedmineDbUser "SoMeuSer" 
        RedmineDbPass "SomePaSS" 
        RedmineProject "digischrank" 
</Location>

But when I move one of these directives (RedmineProject, see (1)) in .htaccess file, Redmine.pm doesn't see it! I've tried to change <Location> to <Directory> and add AllowOverride All. Directives from .htaccess is visible, but remaining ones from <Directory> - not. I don't want to move all directives to each .htaccess. When I add <Location> in addition to <Directory>, again - only directives from <Location> are visible.

As far as I know, directives should be merged. I miss something?

ayaye
  • 111
  • 1

1 Answers1

0

I've found that Redmine.pm doesn't provide DIR_MERGE function to merge configuration objects. See details in Creating and Merging Configuration Objects section of mod_perl manual. I've simplified given example because I need only override mode:

sub DIR_MERGE    { merge(@_) }

sub merge {
      my ($base, $add) = @_;
      my %mrg = ();
      for my $key (keys %$base, keys %$add) {
          next if exists $mrg{$key};
          # override mode
          $mrg{$key} = $base->{$key} if exists $base->{$key};
          $mrg{$key} = $add->{$key}  if exists $add->{$key};
      }
      return bless \%mrg, ref($base);
}
ayaye
  • 111
  • 1