Redmine.pm.patch

Patch for /extra/svn/Redmine.pm - David Rahusen, 2014-04-18 14:07

Download (2.45 KB)

View differences:

Redmine.enhanced.pm 2014-04-18 13:59:49.000000000 +0200
238 238
sub RedmineDSN {
239 239
  my ($self, $parms, $arg) = @_;
240 240
  $self->{RedmineDSN} = $arg;
241
  my $query = "SELECT 
242
                 users.hashed_password, users.salt, users.auth_source_id, roles.permissions, projects.status
243
              FROM projects, users, roles
244
              WHERE 
245
                users.login=? 
246
                AND projects.identifier=?
247
                AND users.status=1 
241
  my $query = "SELECT users.hashed_password, users.salt, users.auth_source_id, roles.permissions, projects.status
242
              FROM projects, users, roles, repositories
243
              WHERE
244
                users.login =  ?
248 245
                AND (
249
                  roles.id IN (SELECT member_roles.role_id FROM members, member_roles WHERE members.user_id = users.id AND members.project_id = projects.id AND members.id = member_roles.member_id)
250
                  OR
251
                  (roles.builtin=1 AND cast(projects.is_public as CHAR) IN ('t', '1'))
246
                  projects.identifier =  ?
247
                  OR projects.id
248
                    IN (
249
                
250
                    SELECT repositories.project_id
251
                    FROM repositories
252
                    WHERE repositories.url LIKE ?
253
                    )
254
                )
255
                AND users.status =1
256
                AND (
257
                  roles.id
258
                  IN (
259
                    SELECT member_roles.role_id
260
                    FROM members, member_roles
261
                    WHERE members.user_id = users.id
262
                    AND members.project_id = projects.id
263
                    AND members.id = member_roles.member_id
264
                  )
265
                  OR (
266
                    roles.builtin =1
267
                    AND CAST( projects.is_public AS CHAR ) 
268
                    IN (
269
                      't',  '1'
270
                    )
271
                  )
252 272
                )
253 273
                AND roles.permissions IS NOT NULL";
254 274
  $self->{RedmineQuery} = trim($query);
......
458 478
  }
459 479
  my $query = $cfg->{RedmineQuery};
460 480
  my $sth = $dbh->prepare($query);
461
  $sth->execute($redmine_user, $project_id);
481
 
482
  my $repo_url = "%".$project_id.".git";
483
  $sth->execute($redmine_user, $project_id, $repo_url);
462 484

  
463 485
  my $ret;
464 486
  while (my ($hashed_password, $salt, $auth_source_id, $permissions, $project_status) = $sth->fetchrow_array) {