diff app/models/.svn/text-base/news.rb.svn-base @ 119:8661b858af72

* Update to Redmine trunk rev 4705
author Chris Cannam
date Thu, 13 Jan 2011 14:12:06 +0000
parents 513646585e45
children cbce1fd3b1b7
line wrap: on
line diff
--- a/app/models/.svn/text-base/news.rb.svn-base	Fri Nov 19 14:05:24 2010 +0000
+++ b/app/models/.svn/text-base/news.rb.svn-base	Thu Jan 13 14:12:06 2011 +0000
@@ -29,6 +29,11 @@
   acts_as_activity_provider :find_options => {:include => [:project, :author]},
                             :author_key => :author_id
   
+  named_scope :visible, lambda {|*args| { 
+    :include => :project,
+    :conditions => Project.allowed_to_condition(args.first || User.current, :view_news) 
+  }}
+  
   def visible?(user=User.current)
     !user.nil? && user.allowed_to?(:view_news, project)
   end