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

controllers/*.py: log some actions in ADMIN

parent 5596d8fd
...@@ -123,7 +123,7 @@ def repair_missing_files(): ...@@ -123,7 +123,7 @@ def repair_missing_files():
db.sequence_file[row.id] = dict(size_file = size) db.sequence_file[row.id] = dict(size_file = size)
res = {"success" : "true", "message" : "DB: references to missing files have been removed: "+flist} res = {"success" : "true", "message" : "DB: references to missing files have been removed: "+flist}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
...@@ -133,7 +133,7 @@ def make_backup(): ...@@ -133,7 +133,7 @@ def make_backup():
db.export_to_csv_file(open(defs.DB_BACKUP_FILE, 'wb')) db.export_to_csv_file(open(defs.DB_BACKUP_FILE, 'wb'))
res = {"success" : "true", "message" : "DB backup -> %s" % defs.DB_BACKUP_FILE} res = {"success" : "true", "message" : "DB backup -> %s" % defs.DB_BACKUP_FILE}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
...@@ -170,5 +170,5 @@ def repair(): ...@@ -170,5 +170,5 @@ def repair():
db.fused_file[row.id] = dict(fuse_date = "1970-01-01 00:00:00") db.fused_file[row.id] = dict(fuse_date = "1970-01-01 00:00:00")
res = {"success" : "true", "message" : "DB repaired: " + flist} res = {"success" : "true", "message" : "DB repaired: " + flist}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
...@@ -42,7 +42,7 @@ def add_form(): ...@@ -42,7 +42,7 @@ def add_form():
res = {"redirect": "config/index", res = {"redirect": "config/index",
"message": "config '%s' added" % request.vars['config_name']} "message": "config '%s' added" % request.vars['config_name']}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else : else :
...@@ -77,7 +77,7 @@ def edit_form(): ...@@ -77,7 +77,7 @@ def edit_form():
res = {"redirect": "config/index", res = {"redirect": "config/index",
"message": "config '%s' updated" % request.vars['config_name']} "message": "config '%s' updated" % request.vars['config_name']}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else : else :
...@@ -99,7 +99,7 @@ def delete(): ...@@ -99,7 +99,7 @@ def delete():
res = {"redirect": "config/index", res = {"redirect": "config/index",
"message": "config '%s' deleted" % request.vars["id"]} "message": "config '%s' deleted" % request.vars["id"]}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
...@@ -169,7 +169,7 @@ def change_permission(): ...@@ -169,7 +169,7 @@ def change_permission():
auth.add_permission(request.vars["group_id"], request.vars["permission"], db.config, request.vars["config_id"]) auth.add_permission(request.vars["group_id"], request.vars["permission"], db.config, request.vars["config_id"])
res = {"message" : "access '%s' granted to '%s'" % (request.vars["permission"], db.auth_group[request.vars["group_id"]].role)} res = {"message" : "access '%s' granted to '%s'" % (request.vars["permission"], db.auth_group[request.vars["group_id"]].role)}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else : else :
res = {"message": "incomplete request : "+error } res = {"message": "incomplete request : "+error }
......
...@@ -54,7 +54,7 @@ def rights(): ...@@ -54,7 +54,7 @@ def rights():
res = { "redirect": "user/info", res = { "redirect": "user/info",
"args" : {"id" : id }, "args" : {"id" : id },
"message": msg} "message": msg}
log.info(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else : else :
res = {"message": "admin only"} res = {"message": "admin only"}
......
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