? 1012132.patch
? 1016350.patch
? 1017036_0.txt
? 1020388_test.patch
? 1030220.txt
? 1042014.patch
? 1051088.patch
? 1051088.txt
? 1051158.patch
? 1051158.txt
? 1054748.txt
? 1057126.patch
? 1058934.patch
? services_better_debug_watchdog.txt
? services_update_spyc.txt
Index: resources/taxonomy_resource.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/resources/taxonomy_resource.inc,v
retrieving revision 1.3
diff -u -p -r1.3 taxonomy_resource.inc
--- resources/taxonomy_resource.inc	24 Dec 2010 17:25:13 -0000	1.3
+++ resources/taxonomy_resource.inc	13 Feb 2011 16:23:10 -0000
@@ -23,9 +23,7 @@ function _taxonomy_resource_definition()
             'description' => 'The tid of the taxonomy term to get',
           ),
         ),
-        'access callback' => '_taxonomy_resource_access',
-        'access arguments' => array('view'),
-        'access arguments append' => TRUE,
+        'access arguments' => array('access content'),
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
       'create' => array(
@@ -39,8 +37,7 @@ function _taxonomy_resource_definition()
             'type' => 'struct',
           ),
         ),
-        'access callback' => '_taxonomy_resource_access',
-        'access arguments' => array('create'),
+        'access callback' => '_taxonomy_resource_create_access',
         'access arguments append' => TRUE,
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
@@ -62,8 +59,7 @@ function _taxonomy_resource_definition()
             'type' => 'struct',
           ),
         ),
-        'access callback' => '_taxonomy_resource_access',
-        'access arguments' => array('update'),
+        'access callback' => '_taxonomy_resource_update_access',
         'access arguments append' => TRUE,
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
@@ -74,6 +70,7 @@ function _taxonomy_resource_definition()
             'name' => 'tid',
             'optional' => FALSE,
             'source' => array('path' => 0),
+            'type' => 'int',
           ),
         ),
         'access callback' => '_taxonomy_resource_access',
@@ -85,8 +82,7 @@ function _taxonomy_resource_definition()
         'selectNodes' => array(
           'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
           'help'   => t('This method returns all nodes with provided taxonomy id.'),
-          'access callback' => '_taxonomy_resource_access',
-          'access arguments' => array('view'),
+          'access arguments' => array('access content'),
           'access arguments append' => TRUE,
           'callback' => 'taxonomy_service_select_nodes',
           'args'     => array(
@@ -136,9 +132,7 @@ function _taxonomy_resource_definition()
             'description' => 'The vid of the taxonomy vocabulary to get',
           ),
         ),
-        'access callback' => '_taxonomy_resource_access',
-        'access arguments' => array('view'),
-        'access arguments append' => TRUE,
+        'access arguments' => array('access content'),
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
       'create' => array(
@@ -152,9 +146,7 @@ function _taxonomy_resource_definition()
             'type' => 'struct',
           ),
         ),
-        'access callback' => '_taxonomy_resource_access',
-        'access arguments' => array('create'),
-        'access arguments append' => TRUE,
+        'access arguments' => array('administer taxonomy'),
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
       'update' => array(
@@ -175,9 +167,7 @@ function _taxonomy_resource_definition()
             'type' => 'struct',
           ),
         ),
-        'access callback' => '_taxonomy_resource_access',
-        'access arguments' => array('update'),
-        'access arguments append' => TRUE,
+        'access arguments' => array('administer taxonomy'),
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
       'delete' => array(
@@ -187,20 +177,17 @@ function _taxonomy_resource_definition()
             'name' => 'vid',
             'optional' => FALSE,
             'source' => array('path' => 0),
+            'type' => 'int',
           ),
         ),
-        'access callback' => '_taxonomy_resource_access',
-        'access arguments' => array('delete'),
-        'access arguments append' => TRUE,
+        'access arguments' => array('administer taxonomy'),
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
       'actions' =>array(
         'getTree' => array(
           'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
           'help'   => t('This method returns a full list of taxonomy terms.'),
-          'access callback' => '_taxonomy_resource_access',
-          'access arguments' => array('view'),
-          'access arguments append' => TRUE,
+          'access arguments' => array('access content'),
           'callback' => 'taxonomy_service_get_tree',
           'args'     => array(
             array(
@@ -217,7 +204,7 @@ function _taxonomy_resource_definition()
               'source'       => 'data',
               'default value' => 0,
               'optional'     => TRUE,
-            ), 
+            ),
             array(
               'name'         => 'maxdepth',
               'type'         => 'int',
@@ -244,7 +231,7 @@ function _taxonomy_resource_definition()
  * @see taxonomy_get_term().
  */
 function _taxonomy_term_resource_retrieve($tid) {
-  return taxonomy_get_term($tid);
+  return taxonomy_term_load($tid);
 }
 
 /**
@@ -265,8 +252,6 @@ function _taxonomy_term_resource_create(
 /**
  * Update a taxonomy term based on submitted values.
  *
- * @param $tid
- *   Unique identifier for the taxonomy term to update.
  * @param $term
  *   Array of values for the taxonomy term.
  * @return
@@ -276,8 +261,7 @@ function _taxonomy_term_resource_create(
  */
 function _taxonomy_term_resource_update($tid, $term) {
   $term = (object) $term;
-  $term->tid = $tid;
-  return _taxonomy_term_resource_create($term);
+  return taxonomy_term_save($term);
 }
 
 /**
@@ -336,11 +320,11 @@ function _taxonomy_vocabulary_resource_r
  * @return
  *   Status constant indicating if vocabulary was inserted or updated.
  *
- * @see taxonomy_save_vocabulary().
+ * @see taxonomy_vocabulary_save().
  */
 function _taxonomy_vocabulary_resource_create($vocabulary) {
-  $vocabulary = (array) $vocabulary;
-  return taxonomy_save_vocabulary($vocabulary);
+  $vocabulary = (object) $vocabulary;
+  return taxonomy_vocabulary_save($vocabulary);
 }
 
 /**
@@ -353,12 +337,11 @@ function _taxonomy_vocabulary_resource_c
  * @return
  *   Status constant indicating if vocabulary was inserted or updated.
  *
- * @see taxonomy_save_vocabulary().
+ * @see taxonomy_vocabulary_save().
  */
 function _taxonomy_vocabulary_resource_update($vid, $vocabulary) {
-  $vocabulary = (array) $vocabulary;
-  $vocabulary['vid'] = $vid;
-  return _taxonomy_vocabulary_resource_create($vocabulary);
+  $vocabulary = (object) $vocabulary;
+  return _taxonomy_vocabulary_save($vocabulary);
 }
 
 /**
@@ -372,7 +355,7 @@ function _taxonomy_vocabulary_resource_u
  * @see taxonomy_del_vocabulary().
  */
 function _taxonomy_vocabulary_resource_delete($vid) {
-  return taxonomy_del_vocabulary($vid);
+  return taxonomy_vocabulary_delete($vid);
 }
 
 
@@ -399,12 +382,12 @@ function taxonomy_service_get_tree($vid,
  *
  * @see
  *   taxonomy_select_nodes().
- * @return 
+ * @return
  *   An array of node objects.
  */
 function taxonomy_service_select_nodes($tid = '', $pager = TRUE, $limit = FALSE,  $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) {
   $result = taxonomy_select_nodes($tid, (bool)$pager, $limit, $order);
-  foreach($result as $nid) {  
+  foreach($result as $nid) {
     if ($uri = services_resource_uri(array('node', $nid))) {
       $node = node_load($nid);
       $node->uri = $uri;
@@ -417,9 +400,41 @@ function taxonomy_service_select_nodes($
   return $nodes;
 }
 
-function _taxonomy_resource_access($op = 'view', $args = array()) {
-  if (user_access('administer taxonomy')) {
-    return TRUE;
-  }
-  // TODO - check perms of user to return ability to interact with terms / vocabulary
+/**
+ * Access callback for term updating.
+ *
+ * @param $term
+ *   An taxonomy term object
+ * @return
+ *   Boolean whether or not the user has access to create or edit the term.
+ */
+function _taxonomy_resource_update_access($tid, $term) {
+  $term = (object) $term;
+  return user_access('edit terms in ' . $term->vid);
+}
+
+/**
+ * Access callback for term creating.
+ *
+ * @param $term
+ *   An taxonomy term object
+ * @return
+ *   Boolean whether or not the user has access to create or edit the term.
+ */
+function _taxonomy_resource_create_access($term) {
+  $term = (object) $term;
+  return user_access('edit terms in ' . $term->vid);
+}
+
+/**
+ * Access callback for term deleting.
+ *
+ * @param $term
+ *   An taxonomy term object
+ * @return
+ *   Boolean whether or not the user has access to delete the term.
+ */
+function _taxonomy_resource_delete_access($tid) {
+  $term = taxnomy_term_load($tid);
+  return user_access('delete terms in ' . $term->vid);
 }
