Added support for Git smart HTTP transport. Add "RedmineSCMProtocol git-smart-http" to the configuration file.
parent
7f3d4406e1
commit
a9f5eb7325
24
Redmine.pm
24
Redmine.pm
|
@ -228,6 +228,12 @@ my @directives = (
|
||||||
args_how => FLAG,
|
args_how => FLAG,
|
||||||
errmsg => 'Grant all permissions to administrators. Defaults to yes.',
|
errmsg => 'Grant all permissions to administrators. Defaults to yes.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name => 'RedmineSCMProtocol',
|
||||||
|
req_override => OR_AUTHCFG,
|
||||||
|
args_how => TAKE1,
|
||||||
|
errmsg => 'Indicate the type of SCM protocol (dav-svn or git-smart-http). This is used to properly detected write requests. Defaults to dev-svn.',
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
# Initialize defaults configuration
|
# Initialize defaults configuration
|
||||||
|
@ -244,6 +250,7 @@ sub DIR_CREATE {
|
||||||
AND members.id = member_roles.member_id
|
AND members.id = member_roles.member_id
|
||||||
AND member_roles.role_id = roles.id
|
AND member_roles.role_id = roles.id
|
||||||
"),
|
"),
|
||||||
|
SCMProtocol => 'dav-svn',
|
||||||
IdentifierRegex => $identifier_re ? qr{$identifier_re} : undef,
|
IdentifierRegex => $identifier_re ? qr{$identifier_re} : undef,
|
||||||
CacheCredsMax => 0,
|
CacheCredsMax => 0,
|
||||||
CacheCredsCount => 0,
|
CacheCredsCount => 0,
|
||||||
|
@ -274,6 +281,17 @@ sub RedmineDbWhereClause {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub RedmineSCMProtocol {
|
||||||
|
my ($cfg, $parms, $arg) = @_;
|
||||||
|
$arg = trim($arg);
|
||||||
|
if($arg eq 'dav-svn' || $arg eq 'git-smart-http') {
|
||||||
|
$cfg->{SCMProtocol} = $arg;
|
||||||
|
} else {
|
||||||
|
die "Invalid RedmineSCMProtocol value: $arg, choose either dav-svn or git-smart-http !";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub set_val {
|
sub set_val {
|
||||||
my ($key, $cfg, $parms, $arg) = @_;
|
my ($key, $cfg, $parms, $arg) = @_;
|
||||||
$cfg->{$key} = $arg;
|
$cfg->{$key} = $arg;
|
||||||
|
@ -517,7 +535,13 @@ sub get_project_identifier {
|
||||||
sub is_read_request {
|
sub is_read_request {
|
||||||
my $r = shift;
|
my $r = shift;
|
||||||
|
|
||||||
|
my $cfg = get_config($r);
|
||||||
|
if($cfg->{SCMProtocol} eq "dav-svn") {
|
||||||
return defined $read_only_methods{$r->method};
|
return defined $read_only_methods{$r->method};
|
||||||
|
} else {
|
||||||
|
my $quoted_location = quotemeta($r->location);
|
||||||
|
return $r->uri !~ m@^$quoted_location/.*/git-receive-pack$@;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if one of the required permissions is in the passed list
|
# check if one of the required permissions is in the passed list
|
||||||
|
|
Loading…
Reference in New Issue