From a6758b5786aaa3abe13a0eb6b7b6e08659af9665 Mon Sep 17 00:00:00 2001 From: Stephen Maiorana <1924654+smaiorana@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:08:00 -0500 Subject: [PATCH 1/5] Issue #3276302 by Natallia Kazarynava, tyler.frankenstein: __clone method called on non-object in services_field_permissions_clean --- resources/taxonomy_resource.inc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/taxonomy_resource.inc b/resources/taxonomy_resource.inc index bb97580..e5c4319 100644 --- a/resources/taxonomy_resource.inc +++ b/resources/taxonomy_resource.inc @@ -373,9 +373,10 @@ function _taxonomy_resource_definition() { */ function _taxonomy_term_resource_retrieve($tid) { $term = taxonomy_term_load($tid); - //Lets check field_permissions - $term = services_field_permissions_clean('view', 'taxonomy_term', $term); - return $term; + // Let's check field_permissions and return term object + return $term ? + services_field_permissions_clean('view', 'taxonomy_term', $term) : + services_error(t('Term @tid not found', array('@tid' => $tid)), 404); } /** From 333d4db38670f05c480b918ae4322b199e4a2afe Mon Sep 17 00:00:00 2001 From: Stephen Maiorana <1924654+smaiorana@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:10:57 -0500 Subject: [PATCH 2/5] Issue #3052316 by solideogloria, tyler.frankenstein: JS behaviors missing .once() --- js/services.admin.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js/services.admin.js b/js/services.admin.js index ed3c9aa..6942063 100644 --- a/js/services.admin.js +++ b/js/services.admin.js @@ -4,8 +4,7 @@ */ Backdrop.behaviors.resourceMenuCollapse = { attach: function (context, settings) { - var timeout = null, - arrowImageHTML = function(collapsed) { + var arrowImageHTML = function(collapsed) { return settings.services.images[collapsed ? 'collapsed' : 'expanded']; }, setRowsCollapsedState = function(toggle, $rows, collapsed) { @@ -18,7 +17,7 @@ $(toggle).html(arrowImageHTML(collapsed)); }; - $('td.resource-select-all').each(function() { + $('td.resource-select-all').once('resource-menu-collapse').each(function() { var resourceName = this.id, resource = settings.services.resources[this.id], $rowElements = $('.' + resourceName + '-method'), @@ -43,7 +42,7 @@ */ Backdrop.behaviors.resourceSelectAll = { attach: function (context, settings) { - $('td.resource-select-all').each(function () { + $('td.resource-select-all').once('resource-select-all').each(function () { var resourceName = this.id, methodCheckboxes = $('.' + resourceName + '-method .resource-method-select input[type=checkbox]'), groupCheckbox = $('').attr('id', this.id + '-select-all'), @@ -70,4 +69,4 @@ }); } }; -})(jQuery); \ No newline at end of file +})(jQuery); From ee56dfba2d8559565e74e3770ec6abc63e10c62f Mon Sep 17 00:00:00 2001 From: Stephen Maiorana <1924654+smaiorana@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:14:51 -0500 Subject: [PATCH 3/5] Issue #3027807 by jacob.embree, tyler.frankenstein: Throw argument error when post comment missing nid --- resources/comment_resource.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/comment_resource.inc b/resources/comment_resource.inc index c0506db..ecfaa2b 100644 --- a/resources/comment_resource.inc +++ b/resources/comment_resource.inc @@ -411,6 +411,9 @@ function _comment_resource_access($op = 'view', $args = array()) { case 'edit': return comment_access('edit', $comment); case 'create': + if (!isset($comment->nid)) { + return services_error(t('Missing required argument nid'), 406); + } // Check if the user may post comments, node has comments enabled // and that the user has access to the node. return user_access('post comments') && ($node->comment == COMMENT_NODE_OPEN); From 664993c9dfb0593bc64d5d207bedde77a209b8aa Mon Sep 17 00:00:00 2001 From: Stephen Maiorana <1924654+smaiorana@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:17:21 -0500 Subject: [PATCH 4/5] Issue #2944445 by GoZ: Resource version does not work with dash in resource name --- services.module | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services.module b/services.module index 657b6e3..ea9a063 100644 --- a/services.module +++ b/services.module @@ -896,8 +896,9 @@ function services_request_apply_version(&$controller, $options = array()) { return; } $updates = services_get_updates(); - if (isset($method) && isset($updates[$resource][$method])) { - foreach ($updates[$resource][$method] as $update) { + $resource_clean_name = str_replace('-', '_', $resource); + if (isset($method) && isset($updates[$resource_clean_name][$method])) { + foreach ($updates[$resource_clean_name][$method] as $update) { if (!isset($version)) { $endpoint = services_get_server_info('endpoint', ''); $endpoint = services_endpoint_load($endpoint); @@ -1186,7 +1187,7 @@ function services_load_endpoint_object($name = NULL) { if (empty($schema) || !$cache_table_exists) { return array(); - } + } // If fetching all we are finished. if (!$name && $cache) { @@ -1205,7 +1206,7 @@ function services_load_endpoint_object($name = NULL) { $query->condition('name', array($name), 'IN'); } $result = $query->execute(); - + // Unpack the results of the query onto objects and cache them. foreach ($result as $data) { $object = new stdClass; From 2ada6ac59ac64c003e075840d3ffe386872a8fd2 Mon Sep 17 00:00:00 2001 From: Stephen Maiorana <1924654+smaiorana@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:18:54 -0500 Subject: [PATCH 5/5] Issue #3277674 by shkiper, tyler.frankenstein, HitchShock: PHP8: deprecated code --- resources/taxonomy_resource.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/taxonomy_resource.inc b/resources/taxonomy_resource.inc index e5c4319..2dcbf77 100644 --- a/resources/taxonomy_resource.inc +++ b/resources/taxonomy_resource.inc @@ -561,7 +561,8 @@ function taxonomy_service_get_by_machine_name($machine_name) { * @return * An array of node objects. */ -function taxonomy_service_select_nodes($tid = '', $pager, $limit, $order) { +function taxonomy_service_select_nodes($tid, $pager, $limit, $order) { + $tid = $tid ? $tid : ''; $result = taxonomy_select_nodes($tid, (bool)$pager, $limit, $order); foreach ($result as $nid) { $node = node_load($nid);