From d20ff61c0fbe10d1ade6716edb6aaf06cf66d5cd Mon Sep 17 00:00:00 2001 From: Ferdi Armbruster Date: Wed, 16 Oct 2013 12:21:35 +0200 Subject: [PATCH] Bugfix in getScopes() Bug in Query and Cast the Resultobjects to Arrays ->join('oauth_scopes','oauth_session_token_scopes.session_access_token_id', '=', 'oauth_scopes.id') to ->join('oauth_scopes', 'oauth_session_token_scopes.scope_id', '=', 'oauth_scopes.id') and cast the Object to an array, because in Resource the Function expects an Array and not an Object --- .../OAuth2Server/Repositories/FluentSession.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php b/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php index 03ebf9c2..1198afff 100644 --- a/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php +++ b/src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php @@ -138,11 +138,18 @@ public function associateScope($accessTokenId, $scopeId) public function getScopes($accessToken) { - return DB::table('oauth_session_token_scopes') - ->join('oauth_session_access_tokens', 'oauth_session_token_scopes.session_access_token_id', '=', 'oauth_session_access_tokens.id') - ->join('oauth_scopes', 'oauth_session_token_scopes.session_access_token_id', '=', 'oauth_scopes.id') - ->where('access_token', $accessToken) - ->get(); + $scope_query = DB::table('oauth_session_token_scopes') + ->join('oauth_session_access_tokens', 'oauth_session_token_scopes.session_access_token_id', '=', 'oauth_session_access_tokens.id') + ->join('oauth_scopes', 'oauth_session_token_scopes.scope_id', '=', 'oauth_scopes.id') + ->where('access_token', $accessToken) + ->get(); + + foreach($scope_query as $scope) + { + $scopes[]['scope'] = $scope->scope; + } + + return $scopes; } public function associateAuthCodeScope($authCodeId, $scopeId)