@@ -208,7 +208,7 sub access_handler { | |||
|
208 | 208 | my $project_id = get_project_identifier($r); |
|
209 | 209 | |
|
210 | 210 | $r->set_handlers(PerlAuthenHandler => [\&OK]) |
|
211 | if is_public_project($project_id, $r); | |
|
211 | if is_public_project($project_id, $r) && anonymous_role_allows_browse_repository($r); | |
|
212 | 212 | |
|
213 | 213 | return OK |
|
214 | 214 | } |
@@ -280,6 +280,29 sub is_public_project { | |||
|
280 | 280 | $ret; |
|
281 | 281 | } |
|
282 | 282 | |
|
283 | sub anonymous_role_allows_browse_repository { | |
|
284 | my $r = shift; | |
|
285 | ||
|
286 | my $dbh = connect_database($r); | |
|
287 | my $sth = $dbh->prepare( | |
|
288 | "SELECT permissions FROM roles WHERE builtin = 2;" | |
|
289 | ); | |
|
290 | ||
|
291 | $sth->execute(); | |
|
292 | my $ret = 0; | |
|
293 | if (my @row = $sth->fetchrow_array) { | |
|
294 | if ($row[0] =~ /:browse_repository/) { | |
|
295 | $ret = 1; | |
|
296 | } | |
|
297 | } | |
|
298 | $sth->finish(); | |
|
299 | undef $sth; | |
|
300 | $dbh->disconnect(); | |
|
301 | undef $dbh; | |
|
302 | ||
|
303 | $ret; | |
|
304 | } | |
|
305 | ||
|
283 | 306 | # perhaps we should use repository right (other read right) to check public access. |
|
284 | 307 | # it could be faster BUT it doesn't work for the moment. |
|
285 | 308 | # sub is_public_project_by_file { |
General Comments 0
You need to be logged in to leave comments.
Login now