Skip to content

Commit

Permalink
Authorise persons on all proposal sessions. Use DISTINCT.
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlLevik committed Oct 20, 2020
1 parent 1ae2d41 commit b9687dd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions schema/stored_programs/sp_retrieve_sample.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BEGIN
IF p_authLogin IS NOT NULL THEN
-- Authorise only if the person (p_authLogin) is a member of a session on the proposal.

SELECT bls.blSampleId "sampleId",
SELECT DISTINCT bls.blSampleId "sampleId",
bls.containerId "containerId",
bls.diffractionPlanId "dataCollectionPlanId",
bls.name "sampleName",
Expand All @@ -28,7 +28,8 @@ BEGIN
INNER JOIN Container c ON c.containerId = bls.containerId
INNER JOIN BLSession bs ON c.sessionId = bs.sessionId
INNER JOIN Proposal p ON p.proposalId = bs.proposalId
INNER JOIN Session_has_Person shp ON bs.sessionId = shp.sessionId
INNER JOIN BLSession bs2 ON bs2.proposalId = p.proposalId
INNER JOIN Session_has_Person shp ON bs2.sessionId = shp.sessionId
INNER JOIN Person pe ON pe.personId = shp.personId
WHERE pe.login = p_authLogin AND bls.blSampleId = p_id;

Expand Down Expand Up @@ -61,7 +62,7 @@ BEGIN
IF p_authLogin IS NOT NULL THEN
-- Authorise only if the person (p_authLogin) is a member of a session on the proposal.

SELECT bls.blSampleId "sampleId",
SELECT DISTINCT bls.blSampleId "sampleId",
bls.containerId "containerId",
bls.diffractionPlanId "dataCollectionPlanId",
bls.name "sampleName",
Expand Down

0 comments on commit b9687dd

Please sign in to comment.