Skip to content

Commit

Permalink
Merge pull request #15 from fx88/patch-1
Browse files Browse the repository at this point in the history
Fixed unsave casts in getScopes() and getAuthCodeScopes() & Add addition...
  • Loading branch information
Luca Degasperi committed Oct 16, 2013
2 parents 2e7c1ca + ae60f25 commit d24192c
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,19 @@ public function associateScope($accessTokenId, $scopeId)

public function getScopes($accessToken)
{
$scope_query = DB::table('oauth_session_token_scopes')
$scopeResults = DB::table('oauth_session_token_scopes')
->select('oauth_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 = array();

foreach($scopeResults as $key=>$scope)
{
$scopes[]['scope'] = $scope->scope;
$scopes[$key] = get_object_vars($scope);

}

return $scopes;
Expand All @@ -164,16 +168,20 @@ public function associateAuthCodeScope($authCodeId, $scopeId)

public function getAuthCodeScopes($oauthSessionAuthCodeId)
{
$result = DB::table('oauth_session_authcode_scopes')
$scopesResults = DB::table('oauth_session_authcode_scopes')
->where('oauth_session_authcode_id', '=', $oauthSessionAuthCodeId)
->get();

$toArray = array();
foreach ($result as $obj) {
$toArray[] = (array)$obj;
}
$scopes = array();

foreach($scopesResults as $key=>$scope)
{
$scopes[$key] = get_object_vars($scope);

}

return $scopes;

return $toArray;
}

public function removeRefreshToken($refreshToken)
Expand Down

0 comments on commit d24192c

Please sign in to comment.