fixed issue 1701:Restore menu/page after end of impersonation, thanks kmouts
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.6.4-stable+timestamp.2013.10.02.13.28.07
|
Version 2.6.4-stable+timestamp.2013.10.02.18.35.36
|
||||||
|
|||||||
+12
-8
@@ -3095,6 +3095,15 @@ class Auth(object):
|
|||||||
redirect(next, client_side=self.settings.client_side)
|
redirect(next, client_side=self.settings.client_side)
|
||||||
return form
|
return form
|
||||||
|
|
||||||
|
def run_login_onaccept(self):
|
||||||
|
onaccept = self.settings.login_onaccept
|
||||||
|
if onaccept:
|
||||||
|
form = Storage(dict(vars=self.user))
|
||||||
|
if not isinstance(onaccept,(list, tuple)):
|
||||||
|
onaccept = [onaccept]
|
||||||
|
for callback in onaccept:
|
||||||
|
callback(form)
|
||||||
|
|
||||||
def is_impersonating(self):
|
def is_impersonating(self):
|
||||||
return self.is_logged_in() and 'impersonator' in current.session.auth
|
return self.is_logged_in() and 'impersonator' in current.session.auth
|
||||||
|
|
||||||
@@ -3128,22 +3137,17 @@ class Auth(object):
|
|||||||
auth.user.update(
|
auth.user.update(
|
||||||
table_user._filter_fields(user, True))
|
table_user._filter_fields(user, True))
|
||||||
self.user = auth.user
|
self.user = auth.user
|
||||||
self.update_groups()
|
self.update_groups()
|
||||||
onaccept = self.settings.login_onaccept
|
|
||||||
log = self.messages['impersonate_log']
|
log = self.messages['impersonate_log']
|
||||||
self.log_event(log, dict(id=current_id, other_id=auth.user.id))
|
self.log_event(log, dict(id=current_id, other_id=auth.user.id))
|
||||||
if onaccept:
|
self.run_login_onaccept()
|
||||||
form = Storage(dict(vars=self.user))
|
|
||||||
if not isinstance(onaccept,(list, tuple)):
|
|
||||||
onaccept = [onaccept]
|
|
||||||
for callback in onaccept:
|
|
||||||
callback(form)
|
|
||||||
elif user_id in (0, '0'):
|
elif user_id in (0, '0'):
|
||||||
if self.is_impersonating():
|
if self.is_impersonating():
|
||||||
session.clear()
|
session.clear()
|
||||||
session.update(cPickle.loads(auth.impersonator))
|
session.update(cPickle.loads(auth.impersonator))
|
||||||
self.user = session.auth.user
|
self.user = session.auth.user
|
||||||
self.update_groups()
|
self.update_groups()
|
||||||
|
self.run_login_onaccept()
|
||||||
return None
|
return None
|
||||||
if requested_id is DEFAULT and not request.post_vars:
|
if requested_id is DEFAULT and not request.post_vars:
|
||||||
return SQLFORM.factory(Field('user_id', 'integer'))
|
return SQLFORM.factory(Field('user_id', 'integer'))
|
||||||
|
|||||||
Reference in New Issue
Block a user