REST_Controller::_check_access PHP Метод

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

Check to see if the API key has access to the controller and methods
protected _check_access ( ) : boolean
Результат boolean TRUE the API key has access; otherwise, FALSE
    protected function _check_access()
    {
        // If we don't want to check access, just return TRUE
        if ($this->config->item('rest_enable_access') === FALSE) {
            return TRUE;
        }
        //check if the key has all_access
        $accessRow = $this->rest->db->where('key', $this->rest->key)->get($this->config->item('rest_access_table'))->row_array();
        if (!empty($accessRow) && !empty($accessRow['all_access'])) {
            return TRUE;
        }
        // Fetch controller based on path and controller name
        $controller = implode('/', [$this->router->directory, $this->router->class]);
        // Remove any double slashes for safety
        $controller = str_replace('//', '/', $controller);
        // Query the access table and get the number of results
        return $this->rest->db->where('key', $this->rest->key)->where('controller', $controller)->get($this->config->item('rest_access_table'))->num_rows() > 0;
    }