0001-Replace-incorrect-.detect-call-by-.any.patch

Patch changing .detect to .any? - Anonymous, 2012-10-11 16:31

Download (1.13 KB)

View differences:

app/models/user.rb
462 462

  
463 463
      roles = roles_for_project(context)
464 464
      return false unless roles
465
      roles.detect {|role|
465
      roles.any? {|role|
466 466
        (context.is_public? || role.member?) &&
467 467
        role.allowed_to?(action) &&
468 468
        (block_given? ? yield(role, self) : true)
......
481 481
      # authorize if user has at least one role that has this permission
482 482
      roles = memberships.collect {|m| m.roles}.flatten.uniq
483 483
      roles << (self.logged? ? Role.non_member : Role.anonymous)
484
      roles.detect {|role|
484
      roles.any? {|role|
485 485
        role.allowed_to?(action) &&
486 486
        (block_given? ? yield(role, self) : true)
487 487
      }
488
-