diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-01-08 17:43:31 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-01-08 17:43:31 +0000 |
commit | 4c0638c5f923008aa03afde1c06b1751a3834712 (patch) | |
tree | a07323af745ebf33d8283fd298acbc777b9f7dbf /app/models/custom_value.rb | |
parent | 10f96ab2ab4c136876c58bef304de00ad33405a0 (diff) | |
download | redmine-4c0638c5f923008aa03afde1c06b1751a3834712.tar.gz redmine-4c0638c5f923008aa03afde1c06b1751a3834712.zip |
Unable to download file if custom field is not defined as visible to any users (#26705).
git-svn-id: http://svn.redmine.org/redmine/trunk@17158 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/custom_value.rb')
-rw-r--r-- | app/models/custom_value.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb index 9a5610930..dc511c0d7 100644 --- a/app/models/custom_value.rb +++ b/app/models/custom_value.rb @@ -37,12 +37,18 @@ class CustomValue < ActiveRecord::Base custom_field.editable? end - def visible? - custom_field.visible? + def visible?(user=User.current) + if custom_field.visible? + true + elsif customized.respond_to?(:project) + custom_field.visible_by?(customized.project, user) + else + false + end end def attachments_visible?(user) - visible? && customized && customized.visible?(user) + visible?(user) && customized && customized.visible?(user) end def required? |