From d9385ce9a2b4aef8e9744106348cffcbcd333efa Mon Sep 17 00:00:00 2001 From: Liwiusz Ociepa Date: Mon, 28 Apr 2008 17:49:49 +0000 Subject: [PATCH] Add support for db_where_clause - that variable is appended to password query. git-svn-id: http://redmine.rubyforge.org/svn/branches/swistak@1378 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- extra/svn/Redmine.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extra/svn/Redmine.pm b/extra/svn/Redmine.pm index 6f3ba4385..49bebf51d 100644 --- a/extra/svn/Redmine.pm +++ b/extra/svn/Redmine.pm @@ -58,6 +58,9 @@ Authen::Simple::LDAP (and IO::Socket::SSL if LDAPS is used): PerlSetVar db_user redmine PerlSetVar db_pass password + # Optional where clause (fulltext search would be slow - and + # is database dependant). + # PerlSetVar db_where_clause "and members.role_id IN (1,2)" To be able to browse repository inside redmine, you must add something @@ -182,8 +185,10 @@ sub is_member { my $pass_digest = Digest::SHA1::sha1_hex($redmine_pass); + my $query = "SELECT hashed_password, auth_source_id FROM members, projects, users WHERE projects.id=members.project_id AND users.id=members.user_id AND users.status=1 AND login=? AND identifier=? "; + my ($where_clause) = map { $r->dir_config($_) } qw/db_where_clause/; my $sth = $dbh->prepare( - "SELECT hashed_password, auth_source_id FROM members, projects, users WHERE projects.id=members.project_id AND users.id=members.user_id AND users.status=1 AND login=? AND identifier=?;" + $query.($where_clause ? $where_clause : "").";" ); $sth->execute($redmine_user, $project_id); -- 2.39.5