comparison app/models/.svn/text-base/document.rb.svn-base @ 210:0579821a129a

Update to Redmine trunk rev 4802
author Chris Cannam
date Tue, 08 Feb 2011 13:51:46 +0000
parents 513646585e45
children cbce1fd3b1b7
comparison
equal deleted inserted replaced
128:07fa8a8b56a8 210:0579821a129a
27 acts_as_activity_provider :find_options => {:include => :project} 27 acts_as_activity_provider :find_options => {:include => :project}
28 28
29 validates_presence_of :project, :title, :category 29 validates_presence_of :project, :title, :category
30 validates_length_of :title, :maximum => 60 30 validates_length_of :title, :maximum => 60
31 31
32 named_scope :visible, lambda {|*args| { :include => :project,
33 :conditions => Project.allowed_to_condition(args.first || User.current, :view_documents) } }
34
32 def visible?(user=User.current) 35 def visible?(user=User.current)
33 !user.nil? && user.allowed_to?(:view_documents, project) 36 !user.nil? && user.allowed_to?(:view_documents, project)
34 end 37 end
35 38
36 def after_initialize 39 def after_initialize