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

WP Descendant query also allows single WP access

Klaus Zanders939dff23e7e2
diff --git a/app/models/work_packages/scopes/left_join_self_and_descendants.rb b/app/models/work_packages/scopes/left_join_self_and_descendants.rb
index 3abcdc17482..9e9631d8610 100644
--- a/app/models/work_packages/scopes/left_join_self_and_descendants.rb
+++ b/app/models/work_packages/scopes/left_join_self_and_descendants.rb
@@ -63,7 +63,9 @@ module WorkPackages::Scopes::LeftJoinSelfAndDescendants
end
def allowed_to_view_work_packages(user)
- wp_descendants_table[:project_id].in(Project.allowed_to(user, :view_work_packages).select(:id).arel)
+ wp_descendants_table[:project_id].in(Project.allowed_to(user, :view_work_packages).select(:id).arel).or(
+ wp_descendants_table[:id].in(WorkPackage.visible(user).select(:id).arel)
+ )
end
def self_or_descendant_condition