1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-21 18:44:37 +02:00

[feature/oauth] Function to update user_id of a token

PHPBB3-9734
This commit is contained in:
Joseph Warner
2013-07-13 23:26:14 -04:00
parent 9619a9a16f
commit 6e73ccd00f

View File

@ -196,4 +196,25 @@ class phpbb_auth_oauth_token_storage implements TokenStorageInterface
$this->db->sql_query($sql); $this->db->sql_query($sql);
} }
/**
* Updates the user_id field in the database assosciated with the token
*
* @param int $user_id
*/
public function set_user_id($user_id)
{
if (!$this->cachedToken)
{
return;
}
$sql = 'UPDATE ' . $this->auth_provider_oauth_table . '
SET ' . $db->sql_build_array('UPDATE', array(
'user_id' => (int) $user_id
)) . '
WHERE user_id = ' . $this->user->data['user_id'] . '
AND session_id = ' . $this->user->data['session_id'];
$this->db->sql_query($sql);
}
} }