From cd55529eaa952d260f99c00a06f0df543b1b4ac3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 27 Jan 2009 18:19:27 +0000 Subject: Fixed that 'My page' blocks may display issues that the user is no longer allowed to view (#2590). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2322 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/models') diff --git a/app/models/issue.rb b/app/models/issue.rb index 11db3f89d..84a3c8e3c 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -51,6 +51,9 @@ class Issue < ActiveRecord::Base validates_inclusion_of :done_ratio, :in => 0..100 validates_numericality_of :estimated_hours, :allow_nil => true + named_scope :visible, lambda {|*args| { :include => :project, + :conditions => Project.allowed_to_condition(args.first || User.current, :view_issues) } } + def after_initialize if new_record? # set default values for new records only -- cgit v1.2.3