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

Change the project visible scope to also include projects that have shared work packages (TBD if this is correct)

Klaus Zandersf3f0d0c39d5b
diff --git a/app/models/project.rb b/app/models/project.rb
index 3876f50c21f..23f0847c243 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -176,7 +176,8 @@ class Project < ApplicationRecord
}
def visible?(user = User.current)
- active? and (public? or user.admin? or user.member_of?(self))
+ active? and (public? or user.admin? or user.member_of?(self) or user.allowed_in_any_work_package?(:view_work_packages,
+ in_project: self))
end
def archived?
@@ -202,7 +203,8 @@ class Project < ApplicationRecord
# to everybody having at least one role in a project regardless of the
# role's permissions.
def self.visible_by(user = User.current)
- allowed_to(user, :view_project)
+ # TODO: Temporary ...
+ allowed_to(user, :view_project).or(where(id: WorkPackage.visible(user).select(:project_id)))
end
# Returns a :conditions SQL string that can be used to find the issues associated with this project.