Skip to content

Commit

Permalink
Bug DCC Issues 592, 645 - Fix for Org Admins seeing deleted Plans for…
Browse files Browse the repository at this point in the history
… Org.

Fixes issues:
https://github.com/DigitalCurationCentre/DMPonline-Service/issues/592
https://github.com/DigitalCurationCentre/DMPonline-Service/issues/645
https://github.com/DigitalCurationCentre/DMPonline-Service/issues/641

The reason we are seeing deleted (de-activated) Plans is that there is
no filter for plans with Roles active in the Org model's
org_admin_plans() method.

Change added .where(roles: { active: true }) to filter plans in
org_admin_plans() method of Org model.
  • Loading branch information
John Pinto committed Jan 11, 2022
1 parent 43c5b03 commit 1173d60
Showing 1 changed file with 2 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 @@ -287,10 +287,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

Expand Down

0 comments on commit 1173d60

Please sign in to comment.