Skip to content

Commit

Permalink
-> #1741: Cohort creation will now check for project/study activity, …
Browse files Browse the repository at this point in the history
…and checks for isb ownership via explicit requirements in the auth_user table
  • Loading branch information
s-paquette committed Nov 14, 2016
1 parent 01f8b90 commit 2734e7c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cohorts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,15 @@ def get_sample_participant_list(user, inc_filters=None, cohort_id=None):
# Query the resulting 'filter_table' (which might just be our original base_table) for the samples
# and participants

cursor.execute("SELECT DISTINCT ms.SampleBarcode, ms.ParticipantBarcode, ps.id FROM %s ms JOIN (SELECT id,name FROM projects_study WHERE owner_id = 1) ps ON ps.name = ms.Study;" % (filter_table,))
cursor.execute("""
SELECT DISTINCT ms.SampleBarcode, ms.ParticipantBarcode, ps.id
FROM %s ms JOIN (
SELECT ps.id AS id,ps.name AS name
FROM projects_study ps
JOIN auth_user au ON au.id = ps.owner_id
WHERE au.is_active = 1 AND au.username = 'isb' AND au.is_superuser = 1 AND ps.active = 1
) ps ON ps.name = ms.Study;
""" % (filter_table,))

for row in cursor.fetchall():
samples_and_participants['items'].append({'sample_barcode': row[0], 'participant_barcode': row[1], 'study_id': row[2]})
Expand Down

0 comments on commit 2734e7c

Please sign in to comment.