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

controllers/default.py: impersonate, log

parent 5ab5f48e
...@@ -467,13 +467,16 @@ def impersonate() : ...@@ -467,13 +467,16 @@ def impersonate() :
if auth.is_impersonating() : if auth.is_impersonating() :
stop_impersonate() stop_impersonate()
if request.vars["id"] != 0 : if request.vars["id"] != 0 :
log.debug({"success" : "true", "message" : "impersonate >> %s" % request.vars["id"]})
auth.impersonate(request.vars["id"]) auth.impersonate(request.vars["id"])
log.debug({"success" : "true", "message" : "impersonated"})
res = {"redirect": "reload"} res = {"redirect": "reload"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def stop_impersonate() : def stop_impersonate() :
import time import time
if auth.is_impersonating() : if auth.is_impersonating() :
log.debug({"success" : "true", "message" : "impersonate << stop"})
auth.impersonate(0) auth.impersonate(0)
# force clean login (default impersonate don't restore everything :/ ) # force clean login (default impersonate don't restore everything :/ )
auth.login_user(db.auth_user(auth.user.id)) auth.login_user(db.auth_user(auth.user.id))
......
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