The relationships added by Services Entity Reference declare '_services_entity_access_callback' as their access callback but this function doesn't actually exists.

As a result any call to that kind of relationship leads to "Access denied".

It seems that this callback has somehow been renamed to '_services_entity_access_callback'. (not sure).

Using the new callback name seems to fix the issue.

Comments

garphy’s picture

Status: Active » Needs review
StatusFileSize
new894 bytes

Patch attached.

joachim’s picture

Status: Needs review » Needs work

That looks like what's happened. Mining git shows the old function:

/**
 * Services resource access callback.
 */
function _services_entity_resource_access($op, $args) {
  $resourceclass = variable_get('services_entity_resource_class', 'ServicesEntityResourceController');
  $resource = new $resourceclass;
  return $resource->access($op, $args);
}

and the new one is:

/**
 * Services access callback.
 *
 * Invokes the 'access' method of the appropriate controller.
 *
 * @param $access_op
 *   The $op value to pass as the first parameter to the controller's
 *   access() method.
 * @param array $args
 *   An array of arguments that will be passed to the resource callback. This
 *   is due to our setting of 'access arguments append' in the resource info.
 *
 * @return boolean
 *   TRUE to grant access, FALSE otherwise.
 */
function _services_entity_access_callback($access_op, $args) {
  // Remove the first of the arguments, which is the resource method name.
  array_shift($args);

  $entity_type = reset($args);
  $controller = _services_entity_get_controller($entity_type);

  return call_user_func_array(array($controller, 'access'), array($access_op, $args));
}

So this looks like the right fix to make. Good catch :)

Though you missed one other occurrence of this. Any chance you could update your patch please?

garphy’s picture

Though you missed one other occurrence of this. Any chance you could update your patch please?

Here's a new patch which include the replacement of both occurrences.

garphy’s picture

Status: Needs work » Needs review

  • joachim committed d7ea9b3 on 7.x-2.x authored by garphy
    Issue #2308339 by garphy: Fixed incorrect access callback for Services...
joachim’s picture

Status: Needs review » Fixed

Perfect. Thanks!

I think this warrants a new release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.