summaryrefslogtreecommitdiffstats
path: root/app/models/time_entry.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-08-09 09:31:16 +0000
committerGo MAEDA <maeda@farend.jp>2019-08-09 09:31:16 +0000
commit3c91a3d5b2f9a2ce55b941ee68fbaa596b5b3052 (patch)
treed54cf120aea24f14b4eb7a06f41749f1eacd6e7a /app/models/time_entry.rb
parent433d8a081f29785ac2d21cba36592678f4001511 (diff)
downloadredmine-3c91a3d5b2f9a2ce55b941ee68fbaa596b5b3052.tar.gz
redmine-3c91a3d5b2f9a2ce55b941ee68fbaa596b5b3052.zip
Per role visibility settings for spent time custom fields (#31859).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18358 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry.rb')
-rw-r--r--app/models/time_entry.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index 9701622c8..d2661d078 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -189,6 +189,13 @@ class TimeEntry < ActiveRecord::Base
editable_custom_field_values(user).map(&:custom_field).uniq
end
+ def visible_custom_field_values(user = nil)
+ user ||= User.current
+ custom_field_values.select do |value|
+ value.custom_field.visible_by?(project, user)
+ end
+ end
+
def assignable_users
users = []
if project