Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -46,6 +46,16 @@ abstract class _Controller
|
||||
* @brief Used OAuth Scope
|
||||
*/
|
||||
protected $usedScope;
|
||||
|
||||
/**
|
||||
* @brief Parameters to mask in logs. Keys are the method names and values an array of field or request keys.
|
||||
*/
|
||||
public $parametersToMask = array();
|
||||
|
||||
/**
|
||||
* @brief Name of the method we called
|
||||
*/
|
||||
public $methodCalled = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -142,7 +152,7 @@ abstract class _Controller
|
||||
$shouldLog = $this->shouldLog( $matches[1], $matches[2], "{$method}{$endpointData['endpoint']}" );
|
||||
if ( !$this->canAccess( $matches[1], $matches[2], "{$method}{$endpointData['endpoint']}" ) )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2S291/3', 403, 'insufficient_scope' );
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2S291/7', 403, 'insufficient_scope' );
|
||||
}
|
||||
|
||||
$reflection = new \ReflectionMethod( $this, "{$method}{$endpointData['endpoint']}" );
|
||||
@@ -151,20 +161,22 @@ abstract class _Controller
|
||||
{
|
||||
if ( isset( $docBlock['details']['apimemberonly'] ) )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2S291/3', 403, 'insufficient_scope' );
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2S291/5', 403, 'insufficient_scope' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isset( $docBlock['details']['apiclientonly'] ) )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2S291/3', 403, 'insufficient_scope' );
|
||||
throw new \IPS\Api\Exception( 'NO_PERMISSION', '2S291/6', 403, 'insufficient_scope' );
|
||||
}
|
||||
}
|
||||
|
||||
$methodName = "{$method}{$endpointData['endpoint']}";
|
||||
$parameters = $endpointData['params'];
|
||||
|
||||
$this->methodCalled = $methodName;
|
||||
|
||||
return $this->$methodName( ...$parameters );
|
||||
}
|
||||
else
|
||||
@@ -243,7 +255,7 @@ abstract class _Controller
|
||||
{
|
||||
if ( $app->enabled OR $includeAll )
|
||||
{
|
||||
$apiDir = \IPS\ROOT_PATH . '/applications/' . $app->directory . '/api';
|
||||
$apiDir = $app->getApplicationPath() . '/api';
|
||||
if ( file_exists( $apiDir ) )
|
||||
{
|
||||
$directory = new \DirectoryIterator( $apiDir );
|
||||
|
||||
Reference in new issue
Block a user