Commit 01de801b authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team
Browse files

controllers/user.py, views/user: access and groups in the user table

parent 73c1a24a
...@@ -8,10 +8,19 @@ if request.env.http_origin: ...@@ -8,10 +8,19 @@ if request.env.http_origin:
def index(): def index():
query = db(db.auth_user).select() query = db(db.auth_user).select()
for row in query : for row in query :
row.created = db( db.patient.creator == row.id ).count() 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.has_permission('upload', 'sequence_file', 0, row.id): row.access += 'u'
if auth.has_permission('run', 'results_file', 0, 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])
row.size = 0 row.size = 0
row.files = 0 row.files = 0
query_size = db( db.sequence_file.provider == row.id ).select() query_size = db( db.sequence_file.provider == row.id ).select()
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
<div id="db_table_container"> <div id="db_table_container">
<table class="db_table" id="table"> <table class="db_table" id="table">
<thead> <thead>
<tr><td class="column_100">id</td> <tr><td class="column_50">id</td>
<td class="column_200"> name</td> <td class="column_200"> name</td>
<td> @</td> <td class="column_200"> @</td>
<td class="colum1">patients created </td> <td class="column_50">access</td>
<td class="colum1">files uploaded </td> <td class="column_100">groups</td>
<td class="column_50">patients created </td>
<td class="column_100">files uploaded </td>
</tr> </tr>
</thead> </thead>
...@@ -20,6 +22,8 @@ ...@@ -20,6 +22,8 @@
<td> {{=row.id}}</td> <td> {{=row.id}}</td>
<td> {{=row.first_name}} {{=row.last_name}}</td> <td> {{=row.first_name}} {{=row.last_name}}</td>
<td> {{=row.email}} </td> <td> {{=row.email}} </td>
<td> {{=row.access}} </td>
<td> {{=row.groups}} </td>
<td> {{=row.created}} </td> <td> {{=row.created}} </td>
<td> {{=row.files}} ({{=vidjil_utils.format_size(row.size)}}) </td> <td> {{=row.files}} ({{=vidjil_utils.format_size(row.size)}}) </td>
</tr> </tr>
......
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