summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-21 14:26:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-21 14:26:51 +0000
commit41eab6615b31185831b110b5e3d29dc08cefceca (patch)
tree1d4e9b3ab4c4eb36052e1d6d8cf6a6953d19c772 /app/models
parent94b621a99fd57462a6dd641044f62b7ecb67ccc2 (diff)
downloadredmine-41eab6615b31185831b110b5e3d29dc08cefceca.tar.gz
redmine-41eab6615b31185831b110b5e3d29dc08cefceca.zip
Enable global time logging at /time_entries/new (#10020).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8691 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 3760a646c..878b4c0ca 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -87,6 +87,17 @@ class Project < ActiveRecord::Base
named_scope :status, lambda {|arg| arg.blank? ? {} : {:conditions => {:status => arg.to_i}} }
named_scope :all_public, { :conditions => { :is_public => true } }
named_scope :visible, lambda {|*args| {:conditions => Project.visible_condition(args.shift || User.current, *args) }}
+ named_scope :allowed_to, lambda {|*args|
+ user = User.current
+ permission = nil
+ if args.first.is_a?(Symbol)
+ permission = args.shift
+ else
+ user = args.shift
+ permission = args.shift
+ end
+ { :conditions => Project.allowed_to_condition(user, permission, *args) }
+ }
named_scope :like, lambda {|arg|
if arg.blank?
{}