Skip to content

Commit

Permalink
Merge pull request #3087 from DMPRoadmap/bug_dcc_592_and_645_deleted-…
Browse files Browse the repository at this point in the history
…private_plans_visible_to_org_admins

Bug DCC Issues 592, 645 - Fix for Org Admins seeing deleted Plans for…
  • Loading branch information
raycarrick-ed authored Feb 1, 2022
2 parents a053f9f + 7d9bd57 commit 001e52a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/org.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,12 @@ def org_admin_plans

if Rails.configuration.x.plans.org_admins_read_all
Plan.includes(:template, :phases, :roles, :users).where(id: combined_plan_ids)
.where(roles: { active: true })
else
Plan.includes(:template, :phases, :roles, :users).where(id: combined_plan_ids)
.where.not(visibility: Plan.visibilities[:privately_visible])
.where.not(visibility: Plan.visibilities[:is_test])
.where(roles: { active: true })
end
end
# rubocop:enable Metrics/AbcSize
Expand Down
2 changes: 2 additions & 0 deletions spec/models/org_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@
@perm = build(:perm)
@perm.name = 'grant_permissions'
user.perms << @perm
plan.add_user!(user.id, :reviewer)
plan.privately_visible!
end

Expand All @@ -411,6 +412,7 @@
@perm = build(:perm)
@perm.name = 'grant_permissions'
user.perms << @perm
plan.add_user!(user.id, :reviewer)
plan.publicly_visible!
end

Expand Down

0 comments on commit 001e52a

Please sign in to comment.