From d149490c789d631ea8a6f06e1bd26fbf98e29dbd Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 30 Apr 2013 15:32:07 +0100 Subject: [PATCH] Updated getScopes --- src/OAuth2/Storage/PDO/Session.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OAuth2/Storage/PDO/Session.php b/src/OAuth2/Storage/PDO/Session.php index ed1f8bc0..bff184a1 100644 --- a/src/OAuth2/Storage/PDO/Session.php +++ b/src/OAuth2/Storage/PDO/Session.php @@ -269,6 +269,12 @@ class Session implements SessionInterface */ public function getScopes($accessToken) { - throw new \Exception('Not implemented - ' . debug_backtrace()[0]['function']); + $db = \ezcDbInstance::get(); + + $stmt = $db->prepare('SELECT oauth_scopes.* FROM oauth_session_token_scopes JOIN oauth_session_access_tokens ON oauth_session_access_tokens.`id` = `oauth_session_token_scopes`.`session_access_token_id` JOIN oauth_scopes ON oauth_scopes.id = `oauth_session_token_scopes`.`scope_id` WHERE access_token = :accessToken'); + $stmt->bindValue(':accessToken', $accessToken); + + $result = $stmt->fetchObject(); + return ($result === false) ? array() : (array) $result; } } \ No newline at end of file