Commit 1d9fff7b authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team
Browse files

VidjilAuth: use can_upload_file(id) instead of has_permission('upload', 'sequence_file', id)

parent c8a2742a
......@@ -14,7 +14,7 @@ def add():
res = {"success" : "false", "message" : "you need admin permission on this patient to add files"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
elif not auth.has_permission('upload', 'sequence_file', request.vars['id'], auth.user_id) and not auth.has_membership("admin"):
elif not auth.can_upload_file(request.vars['id']):
res = {"success" : "false", "message" : "you don't have right to upload files"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -79,7 +79,7 @@ def add_form():
def edit():
if auth.can_modify_patient(request.vars['patient_id']):
return dict(message=T('edit file'))
#elif not auth.has_permission('upload', 'sequence_file', request.vars['id'], auth.user_id):
#elif not auth.can_upload_file(request.vars['id']):
# res = {"success" : "false", "message" : "you don't have right to upload files"}
# return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
......
......@@ -14,10 +14,9 @@ def index():
row.access = ''
if auth.has_permission('create', 'patient', 0, row.id): row.access += 'c'
if auth.has_permission('upload', 'sequence_file', 0, row.id): row.access += 'u'
if auth.can_upload_file(user=row.id): row.access += 'u'
if auth.can_process_file(user=row.id): row.access += 'r'
q = [g.group_id for g in db(db.auth_membership.user_id==row.id).select()]
q.sort()
row.groups = ' '.join([str(g) for g in q])
......
......@@ -24,7 +24,7 @@ query = db(
<input type="checkbox" name="patient" onclick="db.user_rights(this.checked, this.name, 'create', {{=id}});" {{if auth.has_permission('create', 'patient', 0, id) :}}{{="checked"}}{{pass}}>
upload sequence
<input type="checkbox" name="sequence_file" onclick="db.user_rights(this.checked, this.name, 'upload', {{=id}});" {{if auth.has_permission('upload', 'sequence_file', 0, id) :}}{{="checked"}}{{pass}}>
<input type="checkbox" name="sequence_file" onclick="db.user_rights(this.checked, this.name, 'upload', {{=id}});" {{if auth.can_upload_file(user=id) :}}{{="checked"}}{{pass}}>
run vidjil
<input type="checkbox" name="results_file" onclick="db.user_rights(this.checked, this.name, 'run', {{=id}});" {{if auth.can_process_file(id) :}}{{="checked"}}{{pass}}>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment