-
Notifications
You must be signed in to change notification settings - Fork 1
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
Unable to Download Some Organisation Plans on /plans
Path
#732
Comments
def plan_organisationally_exportable?
if @record.is_a?(Plan) && @user.is_a?(User)
byebug
return @record.publicly_visible? ||
(@record.organisationally_visible? && @record.owner.present? &&
@record.owner.org_id == @user.org_id)
end
false
end
Because |
The following upstream issues relate to this problem: This PR also relates to the issue: |
The problem seems to be that some of these plans shouldn't be listed in the
|
This commit is intended to patch issue #732 This DMP Assistant fix was implemented in a way to minimise conflicts with the upstream, DMPRoadmap repo. This issue also exists in the upstream repo, so this commit will be readdressed after a fix is implemented there.
This commit is intended to patch issue #732 This DMP Assistant fix was implemented in a way to minimise conflicts with the upstream, DMPRoadmap repo. This issue also exists in the upstream repo, so this commit will be readdressed after a fix is implemented there.
This commit is intended to patch issue #732 This DMP Assistant fix was implemented in a way to minimise conflicts with the upstream, DMPRoadmap repo. This issue also exists in the upstream repo, so this commit will be readdressed after a fix is implemented there.
WITH all_results AS (
-- 1) Plans where no users with users.org_id = plans.org_id have owner access of the plan
SELECT orgs.id AS affected_org_id, orgs.name AS affected_org_name, plans.id AS plan_id, plans.title AS plan_title
FROM orgs
JOIN plans ON orgs.id = plans.org_id
WHERE plans.visibility = 0
AND plans.complete = true
AND orgs.is_other = false
AND orgs.managed = true
AND NOT EXISTS (
SELECT 1
FROM roles
JOIN users ON roles.user_id = users.id
WHERE users.org_id = plans.org_id
AND roles.plan_id = plans.id
AND users.active = true
AND roles.active = true
AND roles.access = 15
)
UNION ALL
-- 2) Plans where users within an org have administrative access, but no users within that same org have owner access
SELECT orgs.id AS affected_org_id, orgs.name AS affected_org_name, plans.id AS plan_id, plans.title AS plan_title
FROM orgs
JOIN users ON orgs.id = users.org_id
JOIN roles ON users.id = roles.user_id
JOIN plans ON roles.plan_id = plans.id
WHERE plans.visibility = 0
AND plans.complete = true
AND orgs.is_other = false
AND orgs.managed = true
AND roles.active = true
AND users.active = true
AND roles.access IN (2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31)
AND NOT EXISTS (
SELECT 1
FROM roles AS r
JOIN users AS u ON r.user_id = u.id
WHERE r.plan_id = plans.id
AND u.org_id = users.org_id
AND r.active = true
AND u.active = true
AND r.access = 15
)
)
SELECT DISTINCT affected_org_id, affected_org_name, plan_id, plan_title
FROM all_results
ORDER BY affected_org_id, plan_id; |
-- Public plans where no users with users.org_id = plans.org_id are owners of the plan
SELECT orgs.id AS affected_org_id, orgs.name AS affected_org_name, plans.id AS plan_id, plans.title AS plan_title
FROM orgs
JOIN plans ON orgs.id = plans.org_id
WHERE plans.visibility = 1
AND orgs.is_other = false
AND orgs.managed = true
AND complete = true
AND plans.org_id NOT IN (
SELECT users.org_id
FROM users
JOIN roles ON users.id = roles.user_id
AND roles.plan_id = plans.id
AND roles.active = true
AND users.active = true
AND roles.access = 15
); |
Removed |
Please complete the following fields as applicable:
What version of the DMPRoadmap code are you running? (e.g. v2.2.0)
4.0.2+portage-4.0.3
Expected behaviour:
/plans
page.Actual behaviour:
In the
%{org_title} Plans
section of the/plans
page, an error is encountered when attempting to download some plans.(Screenshot of behaviour in development environment)
Steps to reproduce:
Portage Network Plans
The text was updated successfully, but these errors were encountered: