aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-07-13 23:26:14 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-07-14 14:22:43 -0400
commit6e73ccd00f363917de2914de3b8c75d296cdb355 (patch)
tree8a3c2d0a7473e14556c358f4970452f2d9a7698d /phpBB
parent9619a9a16f68edddb052d5848f96f4e603ddc299 (diff)
downloadforums-6e73ccd00f363917de2914de3b8c75d296cdb355.tar
forums-6e73ccd00f363917de2914de3b8c75d296cdb355.tar.gz
forums-6e73ccd00f363917de2914de3b8c75d296cdb355.tar.bz2
forums-6e73ccd00f363917de2914de3b8c75d296cdb355.tar.xz
forums-6e73ccd00f363917de2914de3b8c75d296cdb355.zip
[feature/oauth] Function to update user_id of a token
PHPBB3-9734
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/auth/oauth/token_storage.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/includes/auth/oauth/token_storage.php b/phpBB/includes/auth/oauth/token_storage.php
index b35a5c6586..fcc277053c 100644
--- a/phpBB/includes/auth/oauth/token_storage.php
+++ b/phpBB/includes/auth/oauth/token_storage.php
@@ -196,4 +196,25 @@ class phpbb_auth_oauth_token_storage implements TokenStorageInterface
$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);
+ }
}