Properly handle default repositories.

1.x
Adirelle 2012-04-26 17:08:35 +02:00
parent 4ff2a991ba
commit b7ef1074f0
1 changed files with 3 additions and 3 deletions

View File

@ -453,7 +453,7 @@ sub authz_handler {
($project_id, $is_public, $status) = $dbh->selectrow_array(
"SELECT p.id, p.is_public, p.status
FROM projects p JOIN repositories r ON (p.id = r.project_id)
WHERE p.identifier = ? AND r.type = ?",
WHERE p.identifier = ? AND r.is_default AND r.type = ?",
undef, $identifier, $cfg->{RepositoryType}
);
@ -461,8 +461,8 @@ sub authz_handler {
($identifier, $project_id, $is_public, $status) = $dbh->selectrow_array(
"SELECT p.identifier, p.id, p.is_public, p.status
FROM projects p JOIN repositories r ON (p.id = r.project_id)
WHERE COALESCE(r.identifier, p.identifier) = ? AND r.type = ?",
undef, $repo_id, $cfg->{RepositoryType}
WHERE ((r.is_default AND p.identifier = ?) OR r.identifier = ?) AND r.type = ?",
undef, $repo_id, $repo_id, $cfg->{RepositoryType}
);
}