Pārlūkot izejas kodu

#2634 API: allow custom classes

Alex Trofimov 6 gadi atpakaļ
vecāks
revīzija
d00a4d8f58

+ 2 - 2
modules/boonex/oauth2/classes/BxOAuthAPI.php

@@ -234,10 +234,10 @@ class BxOAuthAPI extends BxDol
         if (!BxDolRequest::serviceExists($sModule, $sMethod, $sClass))
         if (!BxDolRequest::serviceExists($sModule, $sMethod, $sClass))
             return false;
             return false;
 
 
-        if (!BxDolRequest::serviceExists($sModule, $sCheckMethod, $sClass))
+        if (!BxDolRequest::serviceExists($sModule, $sCheckMethod, 'system' == $sModule ? 'TemplServices' : $sClass))
             return false;
             return false;
 
 
-        return BxDolService::call($sModule, $sCheckMethod, array($sMethod));
+        return BxDolService::call($sModule, $sCheckMethod, array($sMethod), 'system' == $sModule ? 'TemplServices' : $sClass);
     }
     }
     
     
 
 

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

@@ -238,13 +238,13 @@ class BxOAuthModule extends BxDolModule
             $this->_oAPI = new BxOAuthAPI($this);
             $this->_oAPI = new BxOAuthAPI($this);
         }
         }
 
 
-        $bPublic = $this->_oAPI->isPublicAPI(bx_get('module') ? bx_get('module') : 'bx_api', $sMethod);
+        $bPublic = $this->_oAPI->isPublicAPI(bx_get('module') ? bx_get('module') : 'bx_api', $sMethod, bx_get('class') ? bx_get('class') : false);
         if ($bPublic) {
         if ($bPublic) {
             $this->checkAllowedOrigins();
             $this->checkAllowedOrigins();
             $this->_oAPI->com($sMethod, array(), $bPublic);
             $this->_oAPI->com($sMethod, array(), $bPublic);
         }
         }
         else {
         else {
-            if (!$this->_oAPI->isSafeAPI(bx_get('module') ? bx_get('module') : 'bx_api', $sMethod)) {
+            if (!$this->_oAPI->isSafeAPI(bx_get('module') ? bx_get('module') : 'bx_api', $sMethod, bx_get('class') ? bx_get('class') : false)) {
                 $this->_oAPI->errorOutput(403, 'access_denied', 'Only "public" and "safe" services can be called, or method doesn\'t exist');
                 $this->_oAPI->errorOutput(403, 'access_denied', 'Only "public" and "safe" services can be called, or method doesn\'t exist');
                 return;
                 return;
             }
             }