function _user_resource_definition in Services 6.3
Same name and namespace in other branches
- 7.3 resources/user_resource.inc \_user_resource_definition()
@file This file will define the resources for dealing with the user object
1 call to _user_resource_definition()
- _services_core_resources in ./
services.resource_build.inc - Supplies the resource definitions for Drupal core data
File
- resources/
user_resource.inc, line 8 - This file will define the resources for dealing with the user object
Code
function _user_resource_definition() {
return array(
'user' => array(
'operations' => array(
'retrieve' => array(
'help' => 'Retrieves a user',
'callback' => '_user_resource_retrieve',
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
'access callback' => '_user_resource_access',
'access arguments' => array(
'view',
),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'uid',
'type' => 'int',
'description' => 'The uid of the user to retrieve.',
'source' => array(
'path' => '0',
),
'optional' => FALSE,
),
),
),
'create' => array(
'help' => 'Creates a user',
'callback' => '_user_resource_create',
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
'access callback' => '_user_resource_access',
'access arguments' => array(
'create',
),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'account',
'type' => 'array',
'description' => 'The user data',
'source' => 'data',
'optional' => FALSE,
),
),
),
'update' => array(
'help' => 'Updates a user',
'callback' => '_user_resource_update',
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
'access callback' => '_user_resource_access',
'access arguments' => array(
'update',
),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'uid',
'type' => 'int',
'description' => 'Unique identifier for this user',
'source' => array(
'path' => 0,
),
'optional' => FALSE,
),
array(
'name' => 'data',
'type' => 'array',
'description' => 'The user data with updated information',
'source' => 'data',
'optional' => FALSE,
),
),
),
'delete' => array(
'help' => 'Deletes a user',
'callback' => '_user_resource_delete',
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
'access callback' => '_user_resource_access',
'access arguments' => array(
'delete',
),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'uid',
'type' => 'int',
'description' => 'The id of the user to delete',
'source' => array(
'path' => '0',
),
'optional' => FALSE,
),
),
),
'index' => array(
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
'callback' => '_user_resource_index',
'args' => array(
array(
'name' => 'page',
'optional' => TRUE,
'type' => 'int',
'description' => 'The zero-based index of the page to get, defaults to 0.',
'default value' => 0,
'source' => array(
'param' => 'page',
),
),
array(
'name' => 'fields',
'optional' => TRUE,
'type' => 'string',
'description' => 'The fields to get.',
'default value' => '*',
'source' => array(
'param' => 'fields',
),
),
array(
'name' => 'parameters',
'optional' => TRUE,
'type' => 'array',
'description' => 'Parameters',
'default value' => NULL,
'source' => array(
'param' => 'parameters',
),
),
array(
'name' => 'pagesize',
'optional' => TRUE,
'type' => 'int',
'description' => 'Number of records to get per page.',
'default value' => variable_get('services_user_index_page_size', 20),
'source' => array(
'param' => 'pagesize',
),
),
),
'access arguments' => array(
'access user profiles',
),
'access arguments append' => FALSE,
),
),
'actions' => array(
'login' => array(
'help' => 'Login a user for a new session',
'callback' => '_user_resource_login',
'args' => array(
array(
'name' => 'username',
'type' => 'string',
'description' => 'A valid username',
'source' => array(
'data' => 'username',
),
'optional' => FALSE,
),
array(
'name' => 'password',
'type' => 'string',
'description' => 'A valid password',
'source' => array(
'data' => 'password',
),
'optional' => FALSE,
),
),
'access callback' => 'services_access_menu',
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
),
'logout' => array(
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
'help' => 'Logout a user session',
'callback' => '_user_resource_logout',
'access callback' => 'services_access_menu',
),
'register' => array(
'help' => 'Registers a user. (anonymous only)',
'callback' => '_user_resource_create',
'file' => array(
'type' => 'inc',
'module' => 'services',
'name' => 'resources/user_resource',
),
'access callback' => '_user_resource_access',
'access arguments' => array(
'register',
),
'access arguments append' => TRUE,
'args' => array(
array(
'name' => 'account',
'type' => 'array',
'description' => 'The user data',
'source' => 'data',
'optional' => FALSE,
),
),
),
),
),
);
}