user_service.module in Services 7
Same filename and directory in other branches
@author Services Dev Team
Link general user functionalities to services module.
File
services/user_service/user_service.moduleView source
<?php
/**
* @author Services Dev Team
* @file
* Link general user functionalities to services module.
*/
/**
* Implementation of hook_help().
*/
function user_service_help($path, $arg) {
switch ($path) {
case 'admin/help#services_user':
return '<p>' . t('Provides user methods to services applications. Requires services.module.') . '</p>';
case 'admin/modules#description':
return t('Provides user methods to services applications. Requires services.module.');
}
}
/**
* Implementation of hook_perm().
*/
function user_service_perm() {
return array(
'get any user data',
'get own user data',
'update any user data',
'update own user data',
'create new users',
'delete any user',
'delete own user',
);
}
/**
* Implementation of hook_service().
*/
function user_service_service() {
return array(
// user.delete
array(
'#method' => 'user.delete',
'#callback' => 'user_service_delete',
'#access callback' => 'user_service_delete_access',
'#file' => array(
'file' => 'inc',
'module' => 'user_service',
),
'#args' => array(
array(
'#name' => 'uid',
'#type' => 'int',
'#description' => t('User ID.'),
),
),
'#return' => 'struct',
'#help' => t('Delete an user.'),
),
// user.get
array(
'#method' => 'user.get',
'#callback' => 'user_service_get',
'#access callback' => 'user_service_get_access',
'#file' => array(
'file' => 'inc',
'module' => 'user_service',
),
'#args' => array(
array(
'#name' => 'uid',
'#type' => 'int',
'#description' => t('User ID.'),
),
),
'#return' => 'struct',
'#help' => t('Get all user details.'),
),
// user.login
array(
'#method' => 'user.login',
'#callback' => 'user_service_login',
'#file' => array(
'file' => 'inc',
'module' => 'user_service',
),
'#args' => array(
array(
'#name' => 'username',
'#type' => 'string',
'#description' => t('A valid username.'),
),
array(
'#name' => 'password',
'#type' => 'string',
'#description' => t('A valid password.'),
),
),
'#return' => 'struct',
'#help' => t('Logs in a user.'),
),
// user.logout
array(
'#method' => 'user.logout',
'#callback' => 'user_service_logout',
'#file' => array(
'file' => 'inc',
'module' => 'user_service',
),
'#args' => array(),
'#return' => 'struct',
'#help' => t('Logs out a user.'),
),
// user.save
array(
'#method' => 'user.save',
'#callback' => 'user_service_save',
'#access callback' => 'user_service_save_access',
'#file' => array(
'file' => 'inc',
'module' => 'user_service',
),
'#args' => array(
array(
'#name' => 'account',
'#type' => 'struct',
'#description' => t('A user object.'),
),
),
'#return' => 'int',
'#help' => t('Save user details.'),
),
);
}
Functions
Name | Description |
---|---|
user_service_help | Implementation of hook_help(). |
user_service_perm | Implementation of hook_perm(). |
user_service_service | Implementation of hook_service(). |