Merged r6203 and r6204 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@6205 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-07-09 11:42:12 +00:00
parent 2a799e8367
commit 0527e8cedf
3 changed files with 7 additions and 1 deletions
+5
View File
@@ -118,6 +118,11 @@ class Project < ActiveRecord::Base
visible(user).find(:all, :limit => count, :order => "created_on DESC")
end
# Returns true if the project is visible to +user+ or to the current user.
def visible?(user=User.current)
user.allowed_to?(:view_project, self)
end
def self.visible_by(user=nil)
ActiveSupport::Deprecation.warn "Project.visible_by is deprecated and will be removed in Redmine 1.3.0. Use Project.visible_condition instead."
visible_condition(user || User.current)