Adds visible scope to redmine links queries.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4759 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2011-01-23 16:47:59 +00:00
1 parent 777ccf1328
commit b20210e83c
3 files changed
+15 -8

No files matched your search

+3
View File
@@ -42,6 +42,9 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher
named_scope :visible, lambda {|*args| { :include => {:board => :project},
:conditions => Project.allowed_to_condition(args.first || User.current, :view_messages) } }
def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_messages, project)
end