summaryrefslogtreecommitdiffstats
path: root/app/models/board.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/board.rb')
-rw-r--r--app/models/board.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/board.rb b/app/models/board.rb
index 0663a13af..a76868d09 100644
--- a/app/models/board.rb
+++ b/app/models/board.rb
@@ -27,6 +27,9 @@ class Board < ActiveRecord::Base
validates_length_of :name, :maximum => 30
validates_length_of :description, :maximum => 255
+ named_scope :visible, lambda {|*args| { :include => :project,
+ :conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } }
+
def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_messages, project)
end