Просмотр исходного кода

#1474 Module Oauth2 Server: "service" scope checking problem

Alex Trofimov 8 лет назад
Родитель
Сommit
85138206ef
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      modules/boonex/oauth2/classes/BxOAuthModule.php

+ 3 - 2
modules/boonex/oauth2/classes/BxOAuthModule.php

@@ -132,8 +132,9 @@ class BxOAuthModule extends BxDolModule
             return;
             return;
         }
         }
 
 
-        $sScope = $this->_oAPI->aAction2Scope[$sAction];
-        if (false === strpos($sScope, $aToken['scope'])) {
+        $aScope = explode(',', $this->_oAPI->aAction2Scope[$sAction]);
+        $aScopeToken = explode(',', $aToken['scope']);
+        if (!array_intersect($aScopeToken, $aScope)) {
             $this->_oAPI->errorOutput(403, 'insufficient_scope', 'The request requires higher privileges than provided by the access token');
             $this->_oAPI->errorOutput(403, 'insufficient_scope', 'The request requires higher privileges than provided by the access token');
             return;
             return;
         }
         }