summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-11 17:14:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-11 17:14:56 +0000
commit8ddcc4caf51c3ae911f7789ad21dcb456ebcf193 (patch)
treea39169476ba2de37a9753bb373baffc1424bf467 /app/models
parent9678e335a46da29ff567a750edf3b6480ca6f844 (diff)
downloadredmine-8ddcc4caf51c3ae911f7789ad21dcb456ebcf193.tar.gz
redmine-8ddcc4caf51c3ae911f7789ad21dcb456ebcf193.zip
Adds a News#commentable? method to easily specific additional rules.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8854 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/news.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/news.rb b/app/models/news.rb
index 78dcc0c8c..eed17945e 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -42,6 +42,11 @@ class News < ActiveRecord::Base
!user.nil? && user.allowed_to?(:view_news, project)
end
+ # Returns true if the news can be commented by user
+ def commentable?(user=User.current)
+ user.allowed_to?(:comment_news, project)
+ end
+
# returns latest news for projects visible by user
def self.latest(user = User.current, count = 5)
find(:all, :limit => count,