Commit d4440737 authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team

VidjilAuth: Use can_create_patient instead of has_permission('create', 'patient')

parent eaed205b
......@@ -417,7 +417,7 @@ def index():
## return form to create new patient
def add():
if (auth.has_permission('create', 'patient') ):
if (auth.can_create_patient()):
return dict(message=T('add patient'))
else :
res = {"message": ACCESS_DENIED}
......@@ -431,7 +431,7 @@ def add():
## redirect to patient list if success
## return a flash error message if fail
def add_form():
if (auth.has_permission('create', 'patient') ):
if (auth.can_create_patient()):
error = ""
if request.vars["first_name"] == "" :
......
......@@ -13,7 +13,7 @@ def index():
row.created = db( db.patient.creator == row.id ).count()
row.access = ''
if auth.has_permission('create', 'patient', 0, row.id): row.access += 'c'
if auth.can_create_patient(user=row.id): row.access += 'c'
if auth.can_upload_file(user=row.id): row.access += 'u'
if auth.can_process_file(user=row.id): row.access += 'r'
......
......@@ -64,7 +64,7 @@
</div>
{{if auth.has_permission("create", "patient") :}}
{{if auth.can_create_patient():}}
<span class="button2" onclick="db.call('patient/add')"> + new patient </span>
<span class="button2" onclick="db.call('patient/custom', {'filter': '{{=request.vars['filter']}}' })"> compare samples/patients </span>
{{else:}}
......
......@@ -21,7 +21,7 @@ query = db(
<div class="db_block">
<div class="db_block_left">
create patient
<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}}>
<input type="checkbox" name="patient" onclick="db.user_rights(this.checked, this.name, 'create', {{=id}});" {{if auth.can_create_patient(id) :}}{{="checked"}}{{pass}}>
upload sequence
<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}}>
......
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