Skip to content

Commit

Permalink
Change the project visible scope to also include projects that have s…
Browse files Browse the repository at this point in the history
…hared work packages (TBD if this is correct)
  • Loading branch information
klaustopher committed Nov 21, 2023
1 parent 3f760ad commit 1be8e09
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -202,7 +203,8 @@ def self.selectable_projects
# 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.
Expand Down

0 comments on commit 1be8e09

Please sign in to comment.