Skip to content

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

simplify project access check & find

as-opf578226fba26
diff --git a/app/models/work_package/exports/macros/attributes.rb b/app/models/work_package/exports/macros/attributes.rb
index 99e8631ef42..90a8e9f892a 100644
--- a/app/models/work_package/exports/macros/attributes.rb
+++ b/app/models/work_package/exports/macros/attributes.rb
@@ -113,9 +113,8 @@ module WorkPackage::Exports
return resolve_label_project(attribute) if type == "label"
return msg_macro_error(I18n.t("export.macro.model_not_found", model: type)) unless type == "value"
- project = Project.find_by(id:)
- if project.nil? ||
- !user.allowed_in_project?(:view_project, project)
+ project = Project.visible(user).find_by(id:)
+ if project.nil?
return msg_macro_error(I18n.t("export.macro.resource_not_found", resource: "#{Project.name} #{id}"))
end