-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does method Org#org_admin_plans
include plans with same org_id
?
#3346
Comments
I think this issue relates to #3345. # app/models/plan.rb
# Retrieves any plan organisationally or publicly visible for a given org id
scope :organisationally_or_publicly_visible, lambda { |user|
plan_ids = user.org.org_admin_plans.where(complete: true).pluck(:id).uniq
includes(: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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: