When an application calls system.connect and the profile module is enabled then this patch will include the user's profile information as part of the object that is returned by the system.connect service.

CommentFileSizeAuthor
#6 system_service-user_load.patch334 bytesarithmetric
system_service_module.patch92 bytesAnonymous (not verified)

Comments

robloach’s picture

Neat idea, might it be good to instead create a user.load function as part of the user service? Then we could load user data from any user.

marcingy’s picture

Assigned: Unassigned » marcingy
snelson’s picture

Category: bug » feature
magico’s picture

Status: Active » Needs work

+1

marcingy’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
arithmetric’s picture

Title: Include user profile data in system.connect return value » Load user object for system.connect return value
Status: Needs work » Needs review
StatusFileSize
new334 bytes

I recently had the same problem and made this patch to load the user object during system.connect. It would be great to see this merged in soon.

Thanks.

marcingy’s picture

Status: Needs review » Closed (won't fix)

This can be achieved by calling user.get after calling the connect function.

tyler.frankenstein’s picture

Version: 6.x-1.x-dev » 8.x-4.x-dev
Issue summary: View changes

Here's how to post process the System Connect call in Drupal 7 to return a fully loaded user account object:

/**
 * Implements hook_services_request_postprocess_alter().
 */
function my_module_services_request_postprocess_alter($controller, $args, &$result) {
  if ($controller['callback'] == '_system_resource_connect') {
    global $user;
    if ($user->uid) {
      $account = user_load($user->uid);
      unset($account->pass);
      $result->user = $account;
    }
  }
}
tyler.frankenstein’s picture

Version: 8.x-4.x-dev » 7.x-3.x-dev

Not sure how I managed to change it to 8.x, I guess I'll change it to 7.x as that's the most relevant now-ish.