You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please complete the following fields as applicable:
What version of the DMPRoadmap code are you running? (e.g. v2.2.0)
4.1.0
Behaviour:
I see that method Org#org_admin_plans
not only lists plans with owners and coowners of that same organization, but also plans that happen to have the attribute org_id set to that organization:
where native_plan_ids is equal to SELECT * FROM plans where org_id = ?
In PlansController#create the plan.org_id is often set to organization of the logged in user. So in that case the organization is equal to the organization of the owner. No problem here
# app/models/plan.rb# Retrieves any plan organisationally or publicly visible for a given org idscope:organisationally_or_publicly_visible,lambda{ |user|
plan_ids=user.org.org_admin_plans.where(complete: true).pluck(:id).uniqincludes(:template,roles: :user).where(id: plan_ids,visibility: [visibilities[:organisationally_visible],visibilities[:publicly_visible]]).where('NOT EXISTS (SELECT 1 FROM roles WHERE plan_id = plans.id AND user_id = ?)',user.id)}
The above scope is used to populate the "Organizational plans" section on the /plans page. However, I think that unwanted plans may be listed here due to the inclusion of native_plan_ids.
Please complete the following fields as applicable:
What version of the DMPRoadmap code are you running? (e.g. v2.2.0)
4.1.0
Behaviour:
I see that method Org#org_admin_plans
not only lists plans with owners and coowners of that same organization, but also plans that happen to have the attribute
org_id
set to that organization:where
native_plan_ids
is equal toSELECT * FROM plans where org_id = ?
In PlansController#create the plan.org_id is often set to organization of the logged in user. So in that case the organization is equal to the organization of the owner. No problem here
But on this line
..
plan.org_id
is set to the organization of the selected primary research organization, as I understand.I see that this method is used on these pages:
/org_admin/plans
/api/v0/plans
Is this intended? I would expect that the org admin would only receive a list of plans
that he/she is affiliated with.
Access policy is different though, and correct in my opinion
The text was updated successfully, but these errors were encountered: