Add simple API panel to Tracy bar

[MAILPOET-2239]
This commit is contained in:
Jan Jakeš
2019-07-31 16:25:48 +02:00
committed by Rostislav Wolný
parent c4b0efe72b
commit 09c35d0745
3 changed files with 97 additions and 0 deletions

View File

@ -4,10 +4,12 @@ namespace MailPoet\API\JSON;
use MailPoet\Config\AccessControl;
use MailPoet\Settings\SettingsController;
use MailPoet\Subscription\Captcha;
use MailPoet\Tracy\ApiPanel\ApiPanel;
use MailPoetVendor\Psr\Container\ContainerInterface;
use MailPoet\Util\Helpers;
use MailPoet\Util\Security;
use MailPoet\WP\Functions as WPFunctions;
use Tracy\Debugger;
if (!defined('ABSPATH')) exit;
@ -164,6 +166,10 @@ class API {
throw new \Exception(__('Invalid API endpoint method.', 'mailpoet'));
}
if (class_exists(Debugger::class)) {
ApiPanel::init($endpoint, $this->_request_method, $this->_request_data);
}
// check the accessibility of the requested endpoint's action
// by default, an endpoint's action is considered "private"
if (!$this->validatePermissions($this->_request_method, $endpoint->permissions)) {