MDL-56765 webservice: On new session is started unset old preferences

This commit is contained in:
Juan Leyva
2016-11-04 19:33:31 +00:00
parent cad8adccc7
commit 1f2e3279b2
+2
View File
@@ -111,6 +111,7 @@ class webservice {
// setup user session to check capability
\core\session\manager::set_user($user);
set_login_session_preferences();
//assumes that if sid is set then there must be a valid associated session no matter the token type
if ($token->sid) {
@@ -1017,6 +1018,7 @@ abstract class webservice_server implements webservice_server_interface {
// now fake user login, the session is completely empty too
enrol_check_plugins($user);
\core\session\manager::set_user($user);
set_login_session_preferences();
$this->userid = $user->id;
if ($this->authmethod != WEBSERVICE_AUTHMETHOD_SESSION_TOKEN && !has_capability("webservice/$this->wsname:use", $this->restricted_context)) {