Makes visible scopes accept projects option and deprecate Project.visible_by.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5324 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -30,7 +30,7 @@ class Document < ActiveRecord::Base
|
||||
validates_length_of :title, :maximum => 60
|
||||
|
||||
named_scope :visible, lambda {|*args| { :include => :project,
|
||||
:conditions => Project.allowed_to_condition(args.first || User.current, :view_documents) } }
|
||||
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_documents, *args) } }
|
||||
|
||||
def visible?(user=User.current)
|
||||
!user.nil? && user.allowed_to?(:view_documents, project)
|
||||
|
||||
Reference in New Issue
Block a user