Created
March 25, 2011 13:57
-
-
Save chrisns/886865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git resources/node_resource.inc resources/node_resource.inc | |
index 1454a2d..8763d0d 100644 | |
--- resources/node_resource.inc | |
+++ resources/node_resource.inc | |
@@ -92,7 +92,7 @@ function _node_resource_definition() { | |
), | |
), | |
'access arguments' => array('access content'), | |
- 'access arguments append' => TRUE, | |
+ // 'access arguments append' => TRUE, | |
), | |
), | |
); | |
@@ -153,7 +153,7 @@ function _node_resource_create($node) { | |
function _node_resource_update($nid, $node) { | |
$node = (object)$node; | |
- $node->nid = $nid; | |
+ $node->nid = arg(2); | |
$old_node = node_load($node->nid); | |
if ($old_node->nid) { | |
@@ -161,7 +161,7 @@ function _node_resource_update($nid, $node) { | |
module_load_include('inc', 'node', 'node.pages'); | |
// Setup form_state. | |
- $values = (array)$node; | |
+ $values = (array)$nid; | |
$form_state = array(); | |
$form_state['values'] = $values; | |
$form_state['values']['op'] = t('Save'); | |
@@ -206,9 +206,9 @@ function _node_resource_index($page = 0, $fields = array(), $parameters = array( | |
list($sql, $params) = $builder->query($fields, $parameters); | |
} | |
else { | |
- $sql = "SELECT * FROM {node} WHERE status = 1 ORDER BY sticky DESC, created DESC"; | |
+ $sql = "SELECT * FROM {node} ORDER BY sticky DESC, created DESC"; | |
} | |
- $res = db_query_range($sql, $params, $page * 20, 20); | |
+ $res = db_query_range($sql, $params, $page * 20, 20000); | |
$events = array(); | |
while ($event = db_fetch_object($res)) { | |
diff --git resources/user_resource.inc resources/user_resource.inc | |
index 200ed33..177409e 100644 | |
--- resources/user_resource.inc | |
+++ resources/user_resource.inc | |
@@ -75,19 +75,20 @@ function _user_resource_definition() { | |
'login' => array( | |
'help' => 'Login a user for a new session', | |
'callback' => '_user_resource_login', | |
+ 'access callback' => 'user_is_anonymous', | |
'args' => array( | |
array( | |
'name' => 'username', | |
'type' => 'string', | |
'description' => 'A valid username', | |
- 'source' => array('data'), | |
+ 'source' => array('data' => 'username'), | |
'optional' => FALSE, | |
), | |
array( | |
'name' => 'password', | |
'type' => 'string', | |
'description' => 'A valid password', | |
- 'source' => array('data'), | |
+ 'source' => array('data' => 'password'), | |
'optional' => FALSE, | |
), | |
), | |
diff --git services.module services.module | |
index 7fc7a2c..766f820 100644 | |
--- services.module | |
+++ services.module | |
@@ -365,19 +365,20 @@ function services_endpoint_list() { | |
* Optional. The endpoint endpoint that's being used. | |
* @return array | |
* An array containing all resources. | |
+ * HACK CNS: neutered all the caching | |
*/ | |
function services_get_resources($endpoint_name = '') { | |
- $cache_key = 'services:' . $endpoint_name . ':resources'; | |
+ // $cache_key = 'services:' . $endpoint_name . ':resources'; | |
$resources = array(); | |
- if (($cache = cache_get($cache_key)) && isset($cache->data)) { | |
- $resources = $cache->data; | |
- } | |
- else { | |
+ // if (($cache = cache_get($cache_key)) && isset($cache->data)) { | |
+ // $resources = $cache->data; | |
+ // } | |
+ // else { | |
module_load_include('resource_build.inc', 'services'); | |
$resources = _services_build_resources($endpoint_name); | |
- cache_set($cache_key, $resources); | |
- } | |
+ // cache_set($cache_key, $resources); | |
+ // } | |
return $resources; | |
} | |
diff --git services.runtime.inc services.runtime.inc | |
index f3a7e3e..11b61a2 100644 | |
--- services.runtime.inc | |
+++ services.runtime.inc | |
@@ -464,9 +464,9 @@ function _comment_resource_access($op = 'view', $args = array()) { | |
*/ | |
function _file_resource_access($op = 'view', $args = array()) { | |
global $user; | |
- if (user_access('administer files')) { | |
+ // if (user_access('administer files')) { | |
return TRUE; | |
- } | |
+ // } | |
if ($op=='create') { | |
$file = (object)$args[0]; | |
@@ -506,6 +506,7 @@ function _node_resource_access($op = 'view', $args = array()) { | |
if ($op != 'create' && !empty($args)) { | |
$node = node_load($args[0]); | |
} | |
+ return true; // HACK CNS node resource doesn't actually get the node in the args | |
return node_access($op, $node); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment