@@ -60,7 +60,7 class Issue < ActiveRecord::Base | |||
|
60 | 60 | validates_numericality_of :estimated_hours, :allow_nil => true |
|
61 | 61 | |
|
62 | 62 | named_scope :visible, lambda {|*args| { :include => :project, |
|
63 |
:conditions => |
|
|
63 | :conditions => Issue.visible_condition(args.first || User.current) } } | |
|
64 | 64 | |
|
65 | 65 | named_scope :open, :conditions => ["#{IssueStatus.table_name}.is_closed = ?", false], :include => :status |
|
66 | 66 | |
@@ -86,6 +86,11 class Issue < ActiveRecord::Base | |||
|
86 | 86 | after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal |
|
87 | 87 | after_destroy :update_parent_attributes |
|
88 | 88 | |
|
89 | # Returns a SQL conditions string used to find all issues visible by the specified user | |
|
90 | def self.visible_condition(user, options={}) | |
|
91 | Project.allowed_to_condition(user, :view_issues, options) | |
|
92 | end | |
|
93 | ||
|
89 | 94 | # Returns true if usr or current user is allowed to view the issue |
|
90 | 95 | def visible?(usr=nil) |
|
91 | 96 | (usr || User.current).allowed_to?(:view_issues, self.project) |
@@ -411,7 +411,7 class Query < ActiveRecord::Base | |||
|
411 | 411 | elsif project |
|
412 | 412 | project_clauses << "#{Project.table_name}.id = %d" % project.id |
|
413 | 413 | end |
|
414 |
project_clauses << |
|
|
414 | project_clauses << Issue.visible_condition(User.current) | |
|
415 | 415 | project_clauses.join(' AND ') |
|
416 | 416 | end |
|
417 | 417 |
General Comments 0
You need to be logged in to leave comments.
Login now