Merge pull request #1080 from mailpoet/json_api_method_check_fix

Throws error when JSON API endpoint method is not found [MAILPOET-1074]
This commit is contained in:
Tautvidas Sipavičius
2017-09-05 13:08:37 +03:00
committed by GitHub
2 changed files with 24 additions and 0 deletions

View File

@ -130,6 +130,10 @@ class API {
$endpoint = new $this->_request_endpoint_class();
if(!method_exists($endpoint, $this->_request_method)) {
throw new \Exception(__('Invalid API endpoint method.', 'mailpoet'));
}
// 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)) {