Commit 1677d5d5 authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team
Browse files

VidjilAuth: Use is_admin() from VidjilAuth

parent 44df59ca
......@@ -14,7 +14,7 @@ if request.env.http_origin:
## return admin_panel
def index():
if auth.has_membership("admin"):
if auth.is_admin():
p = subprocess.Popen(["uptime"], stdout=subprocess.PIPE)
uptime, err = p.communicate()
......@@ -50,7 +50,7 @@ def monitor():
def showlog():
if auth.has_membership("admin"):
if auth.is_admin():
lines = []
......@@ -115,7 +115,7 @@ def showlog():
## to use after change in the upload folder
def repair_missing_files():
if auth.has_membership("admin"):
if auth.is_admin():
flist = ""
for row in db(db.sequence_file.id>0 and db.sequence_file.data_file != None).select() :
......@@ -134,7 +134,7 @@ def repair_missing_files():
def make_backup():
if auth.has_membership("admin"):
if auth.is_admin():
db.export_to_csv_file(open(defs.DB_BACKUP_FILE, 'wb'))
......@@ -144,7 +144,7 @@ def make_backup():
def repair():
if auth.has_membership("admin"):
if auth.is_admin():
flist = "fix creator "
for row in db(db.patient.creator == None).select() :
......
......@@ -18,7 +18,7 @@ def index():
return dict(message=T('Configs'),
query=query,
isAdmin = auth.has_membership("admin"))
isAdmin = auth.is_admin())
def add():
......
......@@ -278,7 +278,7 @@ def index():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
isAdmin = auth.has_membership("admin")
isAdmin = auth.is_admin()
##retrieve patient list
query = db(
......
......@@ -10,7 +10,7 @@ if request.env.http_origin:
## return admin_panel
def index():
if auth.has_membership("admin"):
if auth.is_admin():
query = db(
(db.results_file.sequence_file_id==db.sequence_file.id)
......@@ -57,7 +57,7 @@ def index():
reverse=reverse)
def run_all():
if auth.has_membership("admin"):
if auth.is_admin():
query = db(
(db.results_file_file.sequence_file_id==db.sequence_file.id)
& (db.results_file.config_id==db.config.id)
......
......@@ -39,7 +39,7 @@ def info():
return dict(message=T('user info'))
def rights():
if auth.has_membership("admin"):
if auth.is_admin():
id = request.vars["id"]
group_id = auth.user_group(id)
msg = ""
......
......@@ -107,7 +107,7 @@ def anon_names(patient_id, first_name, last_name, can_view=None):
name = ln[:3]
# Admins also see the patient id
if auth.has_membership("admin"):
if auth.is_admin():
name += ' (%s)' % patient_id
return name
......
......@@ -2,7 +2,7 @@
<div id="db_menu">
<a class="button" onclick="db.call('patient/index');">patients</a>
{{if auth.has_membership("admin"):}}
{{if auth.is_admin():}}
- - -
<a class="button" onclick="db.call('config/index');">configs</a>
<a class="button" onclick="db.call('group/index');">groups</a>
......
......@@ -5,7 +5,7 @@
<div>
{{if auth.has_membership('admin'):}}
{{if auth.is_admin():}}
<span class="button" onclick="db.call('patient/info', {'next': '1', 'id' :'{{=request.vars['id']}}', 'config_id' : '{{=request.vars['config_id']}}'})">prev</span>
<span class="button" onclick="db.call('patient/info', {'next': '-1', 'id' :'{{=request.vars['id']}}', 'config_id' : '{{=request.vars['config_id']}}'})">next</span>
{{ pass }}
......@@ -47,7 +47,7 @@
<td> info </td>
<td> pcr </td>
<td> size </td>
{{if auth.has_membership('admin'):}} <td> uploader </td> {{pass}}
{{if auth.is_admin():}} <td> uploader </td> {{pass}}
<td class="column5"> </td>
<td class="column5"> </td>
<td class="column5"> </td>
......@@ -78,7 +78,7 @@
<td> {{=row.sequence_file.pcr}} </td>
<td {{if row.sequence_file.data_file == None :}} {{=XML("class='inactive' title='file is missing' ")}} {{pass}} >
{{=vidjil_utils.format_size(row.sequence_file.size_file)}} </td>
{{if auth.has_membership('admin'):}}
{{if auth.is_admin():}}
<td> {{=row.sequence_file.provider}} {{if row.sequence_file.provider:}}{{=row.sequence_file.provider.last_name}}{{pass}}</td>
{{pass}}
......
Supports Markdown
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