reduce a bit of code duplication in check_access; make it call check_ref

This commit is contained in:
Sitaram Chamarty 2010-03-23 14:59:33 +05:30
parent b3c5d14421
commit a3f1258a0a

View file

@ -394,13 +394,7 @@ sub check_access
push @allowed_refs, @ { $repos{$repo}{$ENV{GL_USER}} || [] }; push @allowed_refs, @ { $repos{$repo}{$ENV{GL_USER}} || [] };
push @allowed_refs, @ { $repos{$repo}{'@all'} || [] }; push @allowed_refs, @ { $repos{$repo}{'@all'} || [] };
for my $ar (@allowed_refs) { &check_ref(\@allowed_refs, $repo, $ref, $perm);
my $refex = (keys %$ar)[0];
next unless $ref =~ /^$refex/;
die "$perm $ref $ENV{GL_USER} DENIED by $refex\n" if $ar->{$refex} eq '-';
return if ($ar->{$refex} =~ /\Q$perm/);
}
die "$perm $ref $ENV{GL_REPO} $ENV{GL_USER} DENIED by fallthru\n";
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------