Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to specify project identifier. #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions extra/svn/Redmine.pm
Original file line number Diff line number Diff line change
@@ -62,6 +62,9 @@ Authen::Simple::LDAP (and IO::Socket::SSL if LDAPS is used):
# RedmineDbWhereClause "and members.role_id IN (1,2)"
## Optional credentials cache size
# RedmineCacheCredsMax 50
## Optional Redmine project identifier
# If not specified, identifier is generated from uri and location.
# RedmineProjectId hoge
</Location>

To be able to browse repository inside redmine, you must add something
@@ -142,6 +145,11 @@ my @directives = (
args_how => TAKE1,
errmsg => 'RedmineCacheCredsMax must be decimal number',
},
{
name => 'RedmineProjectId',
req_override => OR_AUTHCFG,
args_how => TAKE1,
},
);

sub RedmineDSN {
@@ -178,6 +186,8 @@ sub RedmineCacheCredsMax {
}
}

sub RedmineProjectId { set_val('RedmineProjectId', @_); }

sub trim {
my $string = shift;
$string =~ s/\s{2,}/ /g;
@@ -371,9 +381,17 @@ sub is_member {

sub get_project_identifier {
my $r = shift;

my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);

my $location = $r->location;
my ($identifier) = $r->uri =~ m{$location/*([^/]+)};
my $identifier;

if($cfg->{RedmineProjectId}) {
$identifier = $cfg->{RedmineProjectId};
} else {
$identifier = $r->uri =~ m{$location/*([^/]+)};
}

$identifier;
}