Permalink
Browse files

Have Redmine.pm respect the Authentication Required setting. #5797

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3831 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information...
1 parent 0d5fca9 commit ef5bca0fefea59abd5b9b56140c6f10530a4d302 @edavis10 edavis10 committed Jul 8, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 extra/svn/Redmine.pm
View
@@ -227,9 +227,38 @@ sub authen_handler {
}
}
+# check if authentication is forced
+sub is_authentication_forced {
+ my $r = shift;
+
+ my $dbh = connect_database($r);
+ my $sth = $dbh->prepare(
+ "SELECT value FROM settings where settings.name = 'login_required';"
+ );
+
+ $sth->execute();
+ my $ret = 0;
+ if (my @row = $sth->fetchrow_array) {
+ if ($row[0] eq "1" || $row[0] eq "t") {
+ $ret = 1;
+ }
+ }
+ $sth->finish();
+ undef $sth;
+
+ $dbh->disconnect();
+ undef $dbh;
+
+ $ret;
+}
+
sub is_public_project {
my $project_id = shift;
my $r = shift;
+
+ if (is_authentication_forced($r)) {
+ return 0;
+ }
my $dbh = connect_database($r);
my $sth = $dbh->prepare(

0 comments on commit ef5bca0

Please sign in to comment.