public function RestfulAuthenticationManager::switchUserBack in RESTful 7
Switch the user to the authenticated user, and back.
This should be called only for an API call. It should not be used for calls via the menu system, as it might be a login request, so we avoid switching back to the anonymous user.
File
- plugins/
authentication/ RestfulAuthenticationManager.php, line 182 - Contains RestfulAuthenticationManager.
Class
- RestfulAuthenticationManager
- @file Contains RestfulAuthenticationManager.
Code
public function switchUserBack() {
global $user;
if (!($user_state = $this
->getOriginalUserSession())) {
return;
}
$user = $user_state['user'];
drupal_save_session($user_state['session']);
}