Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions js/services.admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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'),
Expand All @@ -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 = $('<input type="checkbox" class="form-checkbox" />').attr('id', this.id + '-select-all'),
Expand All @@ -70,4 +69,4 @@
});
}
};
})(jQuery);
})(jQuery);
3 changes: 3 additions & 0 deletions resources/comment_resource.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions resources/taxonomy_resource.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -560,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);
Expand Down
9 changes: 5 additions & 4 deletions services.module
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down