OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
check for display rights of project attributes
as-op9ff727c505d2
diff --git a/app/models/exports/formatters/custom_field.rb b/app/models/exports/formatters/custom_field.rbindex 66dac9606b1..ef55bd0aff2 100644--- a/app/models/exports/formatters/custom_field.rb+++ b/app/models/exports/formatters/custom_field.rb@@ -6,7 +6,7 @@ module Exportsend##- # Takes a WorkPackage and an attribute and returns the value to be exported.+ # Takes a WorkPackage or Project and an attribute and returns the value to be exported.def retrieve_value(object)custom_field = find_custom_field(object)return "" if custom_field.nil?diff --git a/app/models/work_package/exports/macros/attributes.rb b/app/models/work_package/exports/macros/attributes.rbindex 659e5db1956..eb48c6be863 100644--- a/app/models/work_package/exports/macros/attributes.rb+++ b/app/models/work_package/exports/macros/attributes.rb@@ -137,7 +137,10 @@ module WorkPackage::Exports# currently we do not support embedding rich text fields: long text custom fieldsreturn msg_macro_error_rich_text if cf.formattable?- # TODO: Is the user allowed to see this custom field/"project attribute"?+ # Is the user allowed to see this custom field/"project attribute"?+ if project.available_custom_fields.find { |pcf| pcf.id == cf.id }.nil?+ return msg_macro_error(I18n.t("export.macro.resource_not_found", resource: attribute))+ endend# currently we do not support embedding rich text field: e.g. projectValue:1234:descriptiondiff --git a/config/initializers/export_formats.rb b/config/initializers/export_formats.rbindex 3b959de7863..9d7603cef5e 100644--- a/config/initializers/export_formats.rb+++ b/config/initializers/export_formats.rb@@ -19,6 +19,7 @@ Rails.application.configure do |application|list Project, Projects::Exports::CSVformatter Project, Exports::Formatters::CustomField+ formatter Project, Exports::Formatters::CustomFieldPdfformatter Project, Projects::Exports::Formatters::Statusformatter Project, Projects::Exports::Formatters::Descriptionformatter Project, Projects::Exports::Formatters::Public