Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
webservice Class Reference

General web service library. More...

Public Member Functions

 add_external_function_to_service ($functionname, $serviceid)
 Add a function to a service.
 
 add_external_service ($service)
 Add a service It generates the timecreated field automatically.
 
 add_ws_authorised_user ($user)
 Allow user to call a service.
 
 authenticate_user ($token)
 Authenticate user (used by download/upload file scripts)
 
 delete_service ($serviceid)
 Delete a service Also delete function references and authorised user references.
 
 delete_user_ws_token ($tokenid)
 Delete a token.
 
 generate_user_ws_tokens ($userid)
 Generate all tokens of a specific user.
 
 get_created_by_user_ws_token ($userid, $tokenid)
 Return a token that has been created by the user (i.e.
 
 get_external_function_by_id ($functionid, $strictness=IGNORE_MISSING)
 Get an external function for a given function id.
 
 get_external_functions ($serviceids)
 Get the functions list of a service list (by id)
 
 get_external_functions_by_enabled_services ($serviceshortnames, $enabledonly=true)
 Get the functions of a service list (by shortname).
 
 get_external_service_by_id ($serviceid, $strictness=IGNORE_MISSING)
 Get an external service for a given service id.
 
 get_external_service_by_shortname ($shortname, $strictness=IGNORE_MISSING)
 Get an external service for a given shortname.
 
 get_missing_capabilities_by_users (array $users, int $serviceid)
 Get missing user capabilities for the given service's functions.
 
 get_not_associated_external_functions ($serviceid)
 Get functions not included in a service.
 
 get_service_required_capabilities ($serviceid)
 Get list of required capabilities of a service, sorted by functions Example of returned value: Array ( [core_group_create_groups] => Array ( [0] => moodle/course:managegroups )
 
 get_token_by_id ($tokenid)
 Return a database token record for a token id.
 
 get_token_by_id_with_details ($tokenid)
 Return a token of an arbitrary user by tokenid, including details of the associated user and the service name.
 
 get_user_capabilities ($userid)
 Get user capabilities (with context) Only useful for documentation purpose WARNING: do not use this "broken" function.
 
 get_user_ws_token ($token)
 Get a full database token record for a given token value.
 
 get_user_ws_tokens ($userid)
 Return all tokens of a specific user.
 
 get_ws_authorised_user ($serviceid, $userid)
 Return an authorised user with their options (ip/timecreated / validuntil...)
 
 get_ws_authorised_users ($serviceid)
 Return list of allowed users with their options (ip/timecreated / validuntil...) for a given service.
 
 remove_external_function_from_service ($functionname, $serviceid)
 Remove a function from a service.
 
 remove_ws_authorised_user ($user, $serviceid)
 Disallow a user to call a service.
 
 service_function_exists ($functionname, $serviceid)
 Test whether an external function is already linked to a service.
 
 update_external_service ($service)
 Update a service It modifies the timemodified automatically.
 
 update_ws_authorised_user ($user)
 Update allowed user settings (ip restriction, valid until...)
 

Static Public Member Functions

static delete_user_ws_tokens ($userid)
 Delete all the tokens belonging to a user.
 
static get_active_tokens ($userid)
 Return a list with all the valid user tokens for the given user, it only excludes expired tokens.
 
static update_token_lastaccess ($token, int $time=0)
 Updates the last access time for a token.
 

Public Attributes

int const TOKEN_LASTACCESS_UPDATE_SECS = 60
 Only update token last access once per this many seconds.
 

Detailed Description

General web service library.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

The documentation for this class was generated from the following file: