REST_Controller::_check_blacklist_auth PHP Метод

_check_blacklist_auth() защищенный Метод

Checks if the client's ip is in the 'rest_ip_blacklist' config and generates a 401 response
protected _check_blacklist_auth ( ) : void
Результат void
    protected function _check_blacklist_auth()
    {
        // Match an ip address in a blacklist e.g. 127.0.0.0, 0.0.0.0
        $pattern = sprintf('/(?:,\\s*|^)\\Q%s\\E(?=,\\s*|$)/m', $this->input->ip_address());
        // Returns 1, 0 or FALSE (on error only). Therefore implicitly convert 1 to TRUE
        if (preg_match($pattern, $this->config->item('rest_ip_blacklist'))) {
            // Display an error response
            $this->response([$this->config->item('rest_status_field_name') => FALSE, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_ip_denied')], self::HTTP_UNAUTHORIZED);
        }
    }