Moodle  2.2.1
http://www.collinsharper.com
webservice Class Reference

Public Member Functions

 authenticate_user ($token)
 add_ws_authorised_user ($user)
 remove_ws_authorised_user ($user, $serviceid)
 update_ws_authorised_user ($user)
 get_ws_authorised_users ($serviceid)
 get_ws_authorised_user ($serviceid, $userid)
 generate_user_ws_tokens ($userid)
 get_user_ws_tokens ($userid)
 get_created_by_user_ws_token ($userid, $tokenid)
 get_token_by_id ($tokenid)
 delete_user_ws_token ($tokenid)
 delete_service ($serviceid)
 get_user_ws_token ($token)
 get_external_functions ($serviceids)
 get_external_functions_by_enabled_services ($serviceshortnames, $enabledonly=true)
 get_not_associated_external_functions ($serviceid)
 get_service_required_capabilities ($serviceid)
 get_user_capabilities ($userid)
 get_missing_capabilities_by_users ($users, $serviceid)
 get_external_service_by_id ($serviceid, $strictness=IGNORE_MISSING)
 get_external_service_by_shortname ($shortname, $strictness=IGNORE_MISSING)
 get_external_function_by_id ($functionid, $strictness=IGNORE_MISSING)
 add_external_function_to_service ($functionname, $serviceid)
 add_external_service ($service)
 update_external_service ($service)
 service_function_exists ($functionname, $serviceid)
 remove_external_function_from_service ($functionname, $serviceid)

Detailed Description

General web service library

Definition at line 35 of file lib.php.


Member Function Documentation

add_external_function_to_service ( functionname,
serviceid 
)

Add a function to a service

Parameters:
string$functionname
integer$serviceid

Definition at line 571 of file lib.php.

add_external_service ( service)

Add a service

Parameters:
object$service
Returns:
serviceid integer

Definition at line 584 of file lib.php.

Add a user to the list of authorised user of a given service

Parameters:
object$user

Definition at line 159 of file lib.php.

authenticate_user ( token)

Authenticate user (used by download/upload file scripts)

Parameters:
string$token
Returns:
array - contains the authenticated user, token and service objects

Definition at line 42 of file lib.php.

Here is the call graph for this function:

delete_service ( serviceid)

Delete a service - it also delete the functions and users references to this service

Parameters:
int$serviceid

Definition at line 353 of file lib.php.

delete_user_ws_token ( tokenid)

Delete a user token

Parameters:
int$tokenid

Definition at line 344 of file lib.php.

generate_user_ws_tokens ( userid)

Generate all ws token needed by a user

Parameters:
int$userid

generate a token for non admin if web service are enable and the user has the capability to create a token

for every service than the user is authorised on, create a token (if it doesn't already exist)

get all services which are set to all user (no restricted to specific users)

Definition at line 233 of file lib.php.

Here is the call graph for this function:

get_created_by_user_ws_token ( userid,
tokenid 
)

Return a user token that has been created by the user If doesn't exist a exception is thrown

Parameters:
integer$userid
integer$tokenid
Returns:
object token ->id token id ->token ->firstname user firstname ->lastname ->name service name

Definition at line 315 of file lib.php.

get_external_function_by_id ( functionid,
strictness = IGNORE_MISSING 
)

Get a external function for a given id

Parameters:
functionid $functionid
integer$strictnessIGNORE_MISSING, MUST_EXIST...
Returns:
object external function

Definition at line 559 of file lib.php.

get_external_functions ( serviceids)

Get the list of all functions for given service ids

Parameters:
array$serviceids
Returns:
array functions

Definition at line 376 of file lib.php.

Here is the caller graph for this function:

get_external_functions_by_enabled_services ( serviceshortnames,
enabledonly = true 
)

Get the list of all functions for given service shortnames

Parameters:
array$serviceshortnames
$enabledonlyif true then only return function for the service that has been enabled
Returns:
array functions

Definition at line 398 of file lib.php.

get_external_service_by_id ( serviceid,
strictness = IGNORE_MISSING 
)

Get a external service for a given id

Parameters:
serviceid $serviceid
integer$strictnessIGNORE_MISSING, MUST_EXIST...
Returns:
object external service

Definition at line 533 of file lib.php.

get_external_service_by_shortname ( shortname,
strictness = IGNORE_MISSING 
)

Get a external service for a given shortname

Parameters:
serviceshortname $shortname
integer$strictnessIGNORE_MISSING, MUST_EXIST...
Returns:
object external service

Definition at line 546 of file lib.php.

get_missing_capabilities_by_users ( users,
serviceid 
)

Get users missing capabilities for a given service

Parameters:
array$users
integer$serviceid
Returns:
array of missing capabilities, the key being the user id

Definition at line 496 of file lib.php.

Here is the call graph for this function:

Get the list of all functions not in the given service id

Parameters:
int$serviceid
Returns:
array functions

Definition at line 422 of file lib.php.

Get list of required capabilities of a service, sorted by functions

Parameters:
integer$serviceid
Returns:
array example of return value: Array ( [moodle_group_create_groups] => Array ( [0] => moodle/course:managegroups )

[moodle_enrol_get_enrolled_users] => Array ( [0] => moodle/site:viewparticipants [1] => moodle/course:viewparticipants [2] => moodle/role:review [3] => moodle/site:accessallgroups [4] => moodle/course:enrolreview ) )

Definition at line 457 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_token_by_id ( tokenid)

Return a token for a given id

Parameters:
integer$tokenid
Returns:
object token

Definition at line 335 of file lib.php.

get_user_capabilities ( userid)

Get user capabilities (with context) Only usefull for documentation purpose

Parameters:
integer$userid
Returns:
array

Definition at line 477 of file lib.php.

Here is the caller graph for this function:

get_user_ws_token ( token)

Get a user token by token

Parameters:
string$token
Exceptions:
moodle_exceptionif there is multiple result

Definition at line 366 of file lib.php.

get_user_ws_tokens ( userid)

Return all ws user token with ws enabled/disabled and ws restricted users mode.

Parameters:
integer$userid
Returns:
array of token

Definition at line 290 of file lib.php.

get_ws_authorised_user ( serviceid,
userid 
)

Return a authorised user with his options (ip/timecreated / validuntil...)

Parameters:
int$serviceid
int$userid
Returns:
object

Definition at line 213 of file lib.php.

get_ws_authorised_users ( serviceid)

Return list of allowed users with their options (ip/timecreated / validuntil...) for a given service

Parameters:
int$serviceid
Returns:
array $users

Definition at line 191 of file lib.php.

remove_external_function_from_service ( functionname,
serviceid 
)

Definition at line 615 of file lib.php.

remove_ws_authorised_user ( user,
serviceid 
)

Remove a user from a list of allowed user of a service

Parameters:
object$user
int$serviceid

Definition at line 170 of file lib.php.

service_function_exists ( functionname,
serviceid 
)

Test whether a external function is already linked to a service

Parameters:
string$functionname
integer$serviceid
Returns:
bool true if a matching function exists for the service, else false.
Exceptions:
dml_exceptionif error

Definition at line 608 of file lib.php.

update_external_service ( service)

Update a service

Parameters:
object$service

Definition at line 595 of file lib.php.

Update service allowed user settings

Parameters:
object$user

Definition at line 180 of file lib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations