I'm new to Drupal, but an experienced PHP programmer. Please forgive the newbie question.
I'm in the process of developing a web service to be accessed via mobile devices (iPhone / Android). I'm not using API key authentication, but am using sessions.
The system.connect method returns more information about the user object than I'd like to see returned (or even need), and I'd like to create a custom connect method as part of my service that can return a valid sessions ID and subsequently disable the system services and user services. However, when I forked the code from the system.connect method and placed that in a custom connection module, I am finding that I have to provide a valid sessions ID to get a response. The system.connect method has no such requirement.
How can I write a custom connect method that behaves like the system.connect method (i.e. drops the requirement for the sessions ID), without having to resort to modifying the system.connect method directly?
Any assistance or pointers would be greatly appreciated. Thanks!
Comments
Hi Ihridley, are you working
Hi Ihridley,
are you working on D6 or D7?
Some questions to shine a little light on the matter for me:
- do you need the user and system services at all? why not disable them from the start?
- the system.connect method just behaves like the system.connect method, what do you need from your system.connect method that you cannot do in a subsequent call to another service method?
cheers
Kind regards,
Rolf Vreijdenberger
drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...
Thanks for responding :)
Thanks for responding :)
I'm working on D6.
My end plan is to disable the system and user services, and replace them with custom services for the specific services I need. However, I need to have sessions functioning. I really only need the capabilities of system.connect, user.login and user.logout for the existing services modules.
In order to get a valid sessions ID, it appears that I need the functionality of system.connect, which, if you have sessions enabled, is the only method I can find that will return a valid sessions ID without having to provide a sessions ID -- see the catch?. What I'd really like to do is duplicate the functionality of system.connect so that i get a valid sessions ID and a subset of the user object -- but when I create a custom connect method Drupal is requiring that I provide a valid sessions ID (which I can't get without sessions.connect).
I've identified the function in the services module where I can disable sessions for a custom method, but to do so requires a hack to the _services_keyauth_alter_methods() function in services_keyauth.inc., which I can do and make it work, but I'm reluctant to do this b/c it means that the upgrade path for the services module gets polluted, and the hack has to be redone with every upgrade. I'd rather use a hook if that's possible. Is it possible to hook into this method? If so, please enlighten me :)
I figured it out!
Thanks for your help.
I just needed to set '#auth' => false in the .modules file – no need to hack!