diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-23 16:47:59 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-23 16:47:59 +0000 |
commit | b20210e83c42807e6445b827504afe64323e272d (patch) | |
tree | eff39b4fa611cd9ec6fae61ff6e124d091dbaeee /app/models/document.rb | |
parent | 777ccf1328c9ebfac33f23e965eccfb5578f182f (diff) | |
download | redmine-b20210e83c42807e6445b827504afe64323e272d.tar.gz redmine-b20210e83c42807e6445b827504afe64323e272d.zip |
Adds visible scope to redmine links queries.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4759 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/document.rb')
-rw-r--r-- | app/models/document.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/document.rb b/app/models/document.rb index 3aae39850..21232a2d9 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -29,6 +29,9 @@ class Document < ActiveRecord::Base validates_presence_of :project, :title, :category validates_length_of :title, :maximum => 60 + named_scope :visible, lambda {|*args| { :include => :project, + :conditions => Project.allowed_to_condition(args.first || User.current, :view_documents) } } + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_documents, project) end |