##// END OF EJS Templates
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
Toshi MARUYAMA -
r7895:2507fd1cd444
parent child
Show More
@@ -49,7 +49,7 Authen::Simple::LDAP (and IO::Socket::SSL if LDAPS is used):
49 49
50 50 PerlAccessHandler Apache::Authn::Redmine::access_handler
51 51 PerlAuthenHandler Apache::Authn::Redmine::authen_handler
52
52
53 53 ## for mysql
54 54 RedmineDSN "DBI:mysql:database=databasename;host=my.db.server"
55 55 ## for postgres
@@ -144,7 +144,7 my @directives = (
144 144 },
145 145 );
146 146
147 sub RedmineDSN {
147 sub RedmineDSN {
148 148 my ($self, $parms, $arg) = @_;
149 149 $self->{RedmineDSN} = $arg;
150 150 my $query = "SELECT
@@ -164,12 +164,12 sub RedmineDSN {
164 164
165 165 sub RedmineDbUser { set_val('RedmineDbUser', @_); }
166 166 sub RedmineDbPass { set_val('RedmineDbPass', @_); }
167 sub RedmineDbWhereClause {
167 sub RedmineDbWhereClause {
168 168 my ($self, $parms, $arg) = @_;
169 169 $self->{RedmineQuery} = trim($self->{RedmineQuery}.($arg ? $arg : "")." ");
170 170 }
171 171
172 sub RedmineCacheCredsMax {
172 sub RedmineCacheCredsMax {
173 173 my ($self, $parms, $arg) = @_;
174 174 if ($arg) {
175 175 $self->{RedmineCachePool} = APR::Pool->new;
@@ -216,10 +216,10 sub access_handler {
216 216
217 217 sub authen_handler {
218 218 my $r = shift;
219
219
220 220 my ($res, $redmine_pass) = $r->get_basic_auth_pw();
221 221 return $res unless $res == OK;
222
222
223 223 if (is_member($r->user, $redmine_pass, $r)) {
224 224 return OK;
225 225 } else {
@@ -246,7 +246,7 sub is_authentication_forced {
246 246 }
247 247 $sth->finish();
248 248 undef $sth;
249
249
250 250 $dbh->disconnect();
251 251 undef $dbh;
252 252
@@ -256,7 +256,7 sub is_authentication_forced {
256 256 sub is_public_project {
257 257 my $project_id = shift;
258 258 my $r = shift;
259
259
260 260 if (is_authentication_forced($r)) {
261 261 return 0;
262 262 }
@@ -283,12 +283,12 sub is_public_project {
283 283
284 284 sub anonymous_role_allows_browse_repository {
285 285 my $r = shift;
286
286
287 287 my $dbh = connect_database($r);
288 288 my $sth = $dbh->prepare(
289 289 "SELECT permissions FROM roles WHERE builtin = 2;"
290 290 );
291
291
292 292 $sth->execute();
293 293 my $ret = 0;
294 294 if (my @row = $sth->fetchrow_array) {
@@ -300,7 +300,7 sub anonymous_role_allows_browse_repository {
300 300 undef $sth;
301 301 $dbh->disconnect();
302 302 undef $dbh;
303
303
304 304 $ret;
305 305 }
306 306
@@ -328,7 +328,7 sub is_member {
328 328 my $project_id = get_project_identifier($r);
329 329
330 330 my $pass_digest = Digest::SHA1::sha1_hex($redmine_pass);
331
331
332 332 my $access_mode = defined $read_only_methods{$r->method} ? "R" : "W";
333 333
334 334 my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
@@ -397,7 +397,7 sub is_member {
397 397
398 398 sub get_project_identifier {
399 399 my $r = shift;
400
400
401 401 my $location = $r->location;
402 402 my ($identifier) = $r->uri =~ m{$location/*([^/]+)};
403 403 $identifier;
@@ -405,7 +405,7 sub get_project_identifier {
405 405
406 406 sub connect_database {
407 407 my $r = shift;
408
408
409 409 my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
410 410 return DBI->connect($cfg->{RedmineDSN}, $cfg->{RedmineDbUser}, $cfg->{RedmineDbPass});
411 411 }
General Comments 0
You need to be logged in to leave comments. Login now