Commit f261259e authored by Mathieu Giraud's avatar Mathieu Giraud

Merge remote-tracking branch 'origin/rbx.vidjil.org'

parents ac8e2e7f a4007abb
......@@ -109,7 +109,7 @@ def get_data():
data["samples"]["original_names"].append(filename)
data["samples"]["info"].append(row.sequence_file.info)
log.info("get_data: %s -> %s" % (request.vars["patient_id"], fused_file))
log.debug("get_data: %s -> %s" % (request.vars["patient_id"], fused_file))
return gluon.contrib.simplejson.dumps(data, separators=(',',':'))
else :
......
......@@ -37,10 +37,12 @@ def add_form():
res = {"redirect": "group/index",
"message" : "group created"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -59,6 +61,7 @@ def delete():
res = {"redirect": "group/index",
"message": "group deleted"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -88,6 +91,7 @@ def remove_permission():
res = {"redirect" : "group/permission" ,
"args" : { "id" : request.vars["group_id"]} }
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
## give admin right to a group member
......@@ -96,6 +100,7 @@ def change_permission():
auth.add_permission(auth.user_group(request.vars["user_id"]), 'admin', db.auth_group, request.vars["group_id"])
res = {"redirect" : "group/permission" , "args" : { "id" : request.vars["group_id"]} }
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
## invite an user to join the group
......@@ -107,12 +112,14 @@ def invite():
res = {"redirect" : "group/info" ,
"args" : { "id" : request.vars["group_id"]},
"message" : "user have been invited to join this group"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
res = {"redirect" : "group/info" ,
"args" : { "id" : request.vars["group_id"]},
"message" : "you don't have permission to invite people"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
## revoke membership
......@@ -124,10 +131,12 @@ def kick():
res = {"redirect" : "group/info" ,
"args" : { "id" : request.vars["group_id"]},
"message" : "user have been kicked"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
res = {"redirect" : "group/info" ,
"args" : { "id" : request.vars["group_id"]},
"message" : "you don't have permission to kick people"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -5,14 +5,16 @@ if request.env.http_origin:
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
ACCESS_DENIED = "access denied"
## return patient file list
##
def info():
log.info('patient (%s)' % request.vars["id"])
log.debug('patient (%s)' % request.vars["id"])
if (auth.has_permission('read', 'patient', request.vars["id"]) ):
return dict(message=T('patient'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -23,7 +25,7 @@ def index():
if not auth.user :
res = {"redirect" : "default/user/login"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
log.info('patient list')
log.debug('patient list')
return dict(message=T(''))
......@@ -33,7 +35,8 @@ def add():
if (auth.has_permission('create', 'patient') ):
return dict(message=T('add patient'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -87,10 +90,12 @@ def add_form():
else :
res = {"success" : "false",
"message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -100,7 +105,8 @@ def edit():
if (auth.has_permission('admin', 'patient', request.vars["id"]) ):
return dict(message=T('edit patient'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -138,9 +144,11 @@ def edit_form():
else :
res = {"success" : "false", "message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -151,10 +159,11 @@ def download():
#
def confirm():
if (auth.has_permission('admin', 'patient', request.vars["id"]) ):
log.info('patient deleted')
log.debug('request patient deletion')
return dict(message=T('confirm patient deletion'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -179,7 +188,7 @@ def delete():
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -189,7 +198,8 @@ def permission():
if (auth.has_permission('admin', 'patient', request.vars["id"]) ):
return dict(message=T('permission'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -208,9 +218,11 @@ def remove_permission():
auth.del_permission(request.vars["group_id"], 'read', db.patient, request.vars["patient_id"])
res = {"redirect" : "patient/permission" , "args" : { "id" : request.vars["patient_id"]} }
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -221,7 +233,9 @@ def change_permission():
auth.add_permission(request.vars["group_id"], request.vars["permission"], db.patient, request.vars["patient_id"])
res = {"redirect" : "patient/permission" , "args" : { "id" : request.vars["patient_id"]} }
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "acces denied"}
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -23,7 +23,7 @@ def run_all():
res = {"success" : "true",
"message" : "rerun all"}
log.info(res)
log.warning(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
## display run page result
......
......@@ -29,7 +29,9 @@ def rights():
res = { "redirect": "user/info",
"args" : {"id" : id },
"message": msg}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "admin only"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -57,6 +57,10 @@ auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
# auth.settings.login_email_validate = False
auth.settings.expiration = 3600 * 24 * 7 # one week
auth.settings.remember_me_form = False
## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in private/janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
......@@ -239,10 +243,18 @@ def _init_log():
logger = logging.getLogger('vidjil') # (request.application)
if not logger.handlers:
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler('/var/vidjil/vidjil.log')
formatter = logging.Formatter('[%(process)d] %(asctime)s %(levelname)8s - %(filename)s:%(lineno)d\t%(message)s')
handler = logging.FileHandler('/var/vidjil/vidjil-debug.log')
handler.setLevel(logging.DEBUG)
handler.setFormatter(logging.Formatter('[%(process)d] %(asctime)s %(levelname)8s - %(filename)s:%(lineno)d\t%(message)s'))
handler.setFormatter(formatter)
logger.addHandler(handler)
handler = logging.FileHandler('/var/vidjil/vidjil.log')
handler.setLevel(logging.INFO)
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.info("Creating logger")
return MsgUserAdapter(logger, {})
......
......@@ -11,8 +11,13 @@
<tr>
<td><label for="config_germline" id="config_germline__label">Germline: </label></td>
<td><select id="config_germline" name="config_germline">
<option value="TRA">TRA</option>
<option value="TRB">TRB</option>
<option value="TRG">TRG</option>
<option value="TRD">TRD</option>
<option value="IGH">IGH</option>
<option value="IGK">IGK</option>
<option value="IGL">IGL</option>
<option value="multi">multi</option>
</select></td>
<td></td>
......
......@@ -16,8 +16,13 @@ info = db.config[request.vars["id"]]
<tr>
<td><label for="config_germline" id="config_germline__label">Germline: </label></td>
<td><select id="config_germline" name="config_germline">
<option value="TRA" {{if info.germline == "TRA":}}selected="selected"{{pass}}>TRA</option>
<option value="TRB" {{if info.germline == "TRB":}}selected="selected"{{pass}}>TRB</option>
<option value="TRG" {{if info.germline == "TRG":}}selected="selected"{{pass}}>TRG</option>
<option value="TRD" {{if info.germline == "TRD":}}selected="selected"{{pass}}>TRD</option>
<option value="IGH" {{if info.germline == "IGH":}}selected="selected"{{pass}}>IGH</option>
<option value="IGK" {{if info.germline == "IGK":}}selected="selected"{{pass}}>IGK</option>
<option value="IGL" {{if info.germline == "IGL":}}selected="selected"{{pass}}>IGL</option>
<option value="multi" {{if info.germline == "multi":}}selected="selected"{{pass}}>multi</option>
</select></td>
<td></td>
......
......@@ -14,8 +14,8 @@
<div id="db_auth">
{{if auth.user:}}
{{=auth.user.first_name}}
<a class="button" onclick="db.request('default/user/logout');">(disconnect)</a>
{{=auth.user.first_name}} {{=auth.user.last_name}}
<a class="button" onclick="db.request('default/user/logout');">(logout)</a>
{{pass}}
</div>
......
......@@ -10,6 +10,9 @@
// .replace("/vidjil", "/vidjil/")
document.getElementById("browser").href = browser_url
window.location.replace(browser_url)
// document.getElementById("db").innerHTML = database_url
}
</script>
......
......@@ -60,6 +60,7 @@ query = db(
<div class="db_block_right">
{{if auth.has_permission("run", "results_file") :}}
config
<span>
<select id="choose_config" name="config" onchange="db.call('patient/info', {'id' :'{{=request.vars['id']}}', 'config_id' : this.value})">
......@@ -71,6 +72,7 @@ query = db(
{{pass}}
</select>
</span>
{{pass}}
</div>
</div>
......@@ -105,7 +107,9 @@ query = db(
{{pass}}
<tr>
<td id="sequence_file_{{=row.sequence_file.id}}"> {{=row.sequence_file.filename}}</td>
<td id="sequence_file_{{=row.sequence_file.id}}"> {{=row.sequence_file.filename[:20]}}
{{if len(row.sequence_file.filename) > 20: }}...{{pass}}
</td>
<td> {{if row.sequence_file.filename == 'plop':}}<a href="{{=URL('patient','download', scheme='https', args=row.sequence_file.data_file)}}" >dl</a>{{pass}}</td>
<td> {{=row.sequence_file.sampling_date}} </td>
<td> {{=row.sequence_file.info}} </td>
......@@ -147,6 +151,12 @@ query = db(
{{else:}}
<span class="button2 inactive" onclick="db.call('file/add', { 'id' : '{{=request.vars["id"]}}' } )" title="you don't have permission to upload files"> add file </span>
{{pass}}
{{if not auth.has_permission("run", "results_file") :}}
<br /> Once your data are uploaded, please
<a href="mailto:contact@vidjil.org?Subject=%5Bvidjil%5D%20New%20sequences&Body=%0AHi%2C%0A%0AI%20uploaded%20some%20sequences%20on%20the%20rbx.vidjil.org%20server.%0ACould%20you%20run%20Vidjil%20on%20these%20data%20%3F%0A%0A">request an analysis</a>.
{{pass}}
</div>
......
......@@ -25,7 +25,7 @@ query = db(
{{for row in query :}}
<tr onclick="db.call('user/info', {'id' :'{{=row.id}}'} )">
<td> {{=row.last_name + " " + row.first_name }} </td>
<td> {{=row.first_name + " " + row.last_name }} </td>
<td> {{=row.email}} </td>
</tr>
{{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