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;
}