Prevent disclosure of done ratio in API v3

pull/2006/head
Hagen Schink 10 years ago
parent eb89ca2340
commit 92d0f8e15b
  1. 6
      lib/api/v3/work_packages/work_package_representer.rb

@ -216,7 +216,7 @@ module API
property :start_date, getter: -> (*) { model.start_date.to_datetime.utc.iso8601 unless model.start_date.nil? }, render_nil: true
property :due_date, getter: -> (*) { model.due_date.to_datetime.utc.iso8601 unless model.due_date.nil? }, render_nil: true
property :estimated_time, render_nil: true
property :percentage_done, render_nil: true
property :percentage_done, render_nil: true, exec_context: :decorator
property :version_id, getter: -> (*) { model.fixed_version.try(:id) }, render_nil: true
property :version_name, getter: -> (*) { model.fixed_version.try(:name) }, render_nil: true
property :project_id, getter: -> (*) { model.project.id }
@ -265,6 +265,10 @@ module API
def visible_children
@visible_children ||= represented.model.children.find_all { |child| child.visible? }
end
def percentage_done
(Setting.work_package_done_ratio == 'disabled') ? nil : represented.percentage_done
end
end
end
end

Loading…
Cancel
Save