/[drupal]/contributions/modules/restapi/restapi_login.module
ViewVC logotype

Contents of /contributions/modules/restapi/restapi_login.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Wed Mar 19 20:44:05 2008 UTC (20 months, 1 week ago) by hanenkamp
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5
File MIME type: text/x-php
* I've rewritten parts of the API to make new modules easier to write (and so that the central REST API module actually helps a bit more).
* I've added a module for Services support and a helper for Login.
* The main REST API module and REST API User module have been tested a bit more.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Provies a module for giving access to login to the REST API modules.
7 */
8
9 /**
10 * Implementes hook_restapi_menu(). Adds the login callback.
11 */
12 function restapi_login_restapi_menu($may_cache) {
13 if ($may_cache) {
14 $items[] = array(
15 'method' => 'POST',
16 'path' => '=/login',
17 'callback' => 'restapi_login_login',
18 'access' => TRUE,
19 );
20 }
21
22 return $items;
23 }
24
25 /**
26 * Implements hook_restapi_help(). Shows help for POST to login.
27 */
28 function restapi_login_restapi_help() {
29 $help['prototypes'][] = array(
30 'method' => 'POST',
31 'path' => '/=/login',
32 'description' => 'Given "name" and "pass" arguments, uses the "user_login" form to log the client into the system.',
33 );
34
35 return $help;
36 }
37
38 /**
39 * Handles /=/login
40 */
41 function restapi_login_login($data) {
42 $result = drupal_execute('user_login', $data);
43 print restapi_serialize($result);
44 }

  ViewVC Help
Powered by ViewVC 1.1.2