0002-Fix-bug-with-private-issues-submitted-by-or-assigned.patch

Fix bug with private issues submitted by or assigned to - Anonymous, 2012-09-19 15:03

Download (2.08 KB)

View differences:

app/models/issue.rb
87 87
      when 'all'
88 88
        nil
89 89
      when 'default'
90
        user_ids = [user.id] + user.groups.map(&:id)
91
        "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
90
        if user.logged?
91
          user_ids = [user.id] + user.groups.map(&:id)
92
          "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
93
        else
94
          "(#{table_name}.is_private = #{connection.quoted_false})"
95
        end
92 96
      when 'own'
93
        user_ids = [user.id] + user.groups.map(&:id)
94
        "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
97
        if user.logged?
98
          user_ids = [user.id] + user.groups.map(&:id)
99
          "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
100
        else
101
          '1=0'
102
        end
95 103
      else
96 104
        '1=0'
97 105
      end
......
105 113
      when 'all'
106 114
        true
107 115
      when 'default'
108
        !self.is_private? || self.author == user || user.is_or_belongs_to?(assigned_to)
116
        !self.is_private? || (user.logged? && (self.author == user || user.is_or_belongs_to?(assigned_to)))
109 117
      when 'own'
110
        self.author == user || user.is_or_belongs_to?(assigned_to)
118
        user.logged? && (self.author == user || user.is_or_belongs_to?(assigned_to))
111 119
      else
112 120
        false
113 121
      end
114
-