Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Static list of api methods for system oauth2 configuration. More...
Static Public Member Functions | |
static | connect_system_account ($issuer, $returnurl) |
Perform the OAuth dance and get a refresh token. More... | |
static | create_endpoint ($data) |
Take the data from the mform and create the endpoint. More... | |
static | create_endpoints_for_standard_issuer ($type, $issuer) |
Create endpoints for standard issuers, based on the issuer created from submitted data. More... | |
static | create_issuer ($data) |
Take the data from the mform and create the issuer. More... | |
static | create_standard_issuer ($type, $baseurl=false) |
Create one of the standard issuers. More... | |
static | create_user_field_mapping ($data) |
Take the data from the mform and create the user field mapping. More... | |
static | delete_endpoint ($id) |
Delete an endpoint. More... | |
static | delete_issuer ($id) |
Delete an identity issuer. More... | |
static | delete_user_field_mapping ($id) |
Delete a user_field_mapping. More... | |
static | disable_issuer ($id) |
Disable an identity issuer. More... | |
static | enable_issuer ($id) |
Enable an identity issuer. More... | |
static | get_all_issuers () |
List all the issuers, ordered by the sortorder field. More... | |
static | get_endpoint ($id) |
Get a single endpoint by id. More... | |
static | get_endpoints (issuer $issuer) |
Get the list of defined endpoints for this OAuth issuer. More... | |
static | get_issuer ($id) |
Get a single issuer by id. More... | |
static | get_system_account (issuer $issuer) |
Get the system account for an installed OAuth service. More... | |
static | get_system_oauth_client (issuer $issuer) |
Get an authenticated oauth2 client using the system account. More... | |
static | get_system_scopes_for_issuer ($issuer) |
Get the full list of system scopes required by an oauth issuer. More... | |
static | get_user_field_mapping ($id) |
Get a single user field mapping by id. More... | |
static | get_user_field_mappings (issuer $issuer) |
Get the list of defined mapping from OAuth user fields to moodle user fields. More... | |
static | get_user_oauth_client (issuer $issuer, moodle_url $currenturl, $additionalscopes='') |
Get an authenticated oauth2 client using the current user account. More... | |
static | init_standard_issuer ($type) |
Initializes a record for one of the standard issuers to be displayed in the settings. More... | |
static | move_down_issuer ($id) |
Reorder this identity issuer. More... | |
static | move_up_issuer ($id) |
Reorder this identity issuer. More... | |
static | update_endpoint ($data) |
Take the data from the mform and update the endpoint. More... | |
static | update_issuer ($data) |
Take the data from the mform and update the issuer. More... | |
static | update_user_field_mapping ($data) |
Take the data from the mform and update the user field mapping. More... | |
Static Protected Member Functions | |
static | discover_endpoints ($issuer) |
If the discovery endpoint exists for this issuer, try and determine the list of valid endpoints. More... | |
static | guess_image ($issuer) |
Guess an image from the discovery URL. More... | |
Static list of api methods for system oauth2 configuration.
|
static |
Perform the OAuth dance and get a refresh token.
Requires moodle/site:config capability at the system context.
core::oauth2::issuer | $issuer | |
moodle_url | $returnurl | The url to the current page (we will be redirected back here after authentication). |
boolean |
|
static |
Take the data from the mform and create the endpoint.
stdClass | $data |
core::oauth2::endpoint |
|
static |
Create endpoints for standard issuers, based on the issuer created from submitted data.
string | $type | One of google, facebook, microsoft, nextcloud |
issuer | $issuer | issuer the endpoints should be created for. |
core::oauth2::issuer |
|
static |
Take the data from the mform and create the issuer.
stdClass | $data |
core::oauth2::issuer |
|
static |
Create one of the standard issuers.
string | $type | One of google, facebook, microsoft, or nextcloud |
string | false | $baseurl | Baseurl (only required for nextcloud) |
core::oauth2::issuer |
|
static |
Take the data from the mform and create the user field mapping.
stdClass | $data |
core::oauth2::user_field_mapping |
|
static |
Delete an endpoint.
Requires moodle/site:config capability at the system context.
int | $id | The id of the endpoint to delete. |
boolean |
|
static |
Delete an identity issuer.
Requires moodle/site:config capability at the system context.
int | $id | The id of the identity issuer to delete. |
boolean |
|
static |
Delete a user_field_mapping.
Requires moodle/site:config capability at the system context.
int | $id | The id of the user_field_mapping to delete. |
boolean |
|
static |
Disable an identity issuer.
Requires moodle/site:config capability at the system context.
int | $id | The id of the identity issuer to disable. |
boolean |
|
staticprotected |
If the discovery endpoint exists for this issuer, try and determine the list of valid endpoints.
issuer | $issuer |
int | The number of discovered services. |
|
static |
Enable an identity issuer.
Requires moodle/site:config capability at the system context.
int | $id | The id of the identity issuer to enable. |
boolean |
|
static |
List all the issuers, ordered by the sortorder field.
core::oauth2::issuer[] |
|
static |
|
static |
Get the list of defined endpoints for this OAuth issuer.
core::oauth2::issuer | $issuer | The desired OAuth issuer |
core::oauth2::endpoint[] |
|
static |
|
static |
Get the system account for an installed OAuth service.
Never ever ever expose this to a webservice because it contains the refresh token which grants API access.
core::oauth2::issuer | $issuer |
system_account|false |
|
static |
Get an authenticated oauth2 client using the system account.
This call uses the refresh token to get an access token.
core::oauth2::issuer | $issuer |
core::oauth2::client|false | An authenticated client (or false if the token could not be upgraded) |
moodle_exception | Request for token upgrade failed for technical reasons |
|
static |
Get the full list of system scopes required by an oauth issuer.
This includes the list required for login as well as any scopes injected by the oauth2_system_scopes callback in plugins.
core::oauth2::issuer | $issuer |
string |
|
static |
Get a single user field mapping by id.
int | $id |
core::oauth2::user_field_mapping |
|
static |
Get the list of defined mapping from OAuth user fields to moodle user fields.
core::oauth2::issuer | $issuer | The desired OAuth issuer |
core::oauth2::user_field_mapping[] |
|
static |
Get an authenticated oauth2 client using the current user account.
This call does the redirect dance back to the current page after authentication.
core::oauth2::issuer | $issuer | The desired OAuth issuer |
moodle_url | $currenturl | The url to the current page. |
string | $additionalscopes | The additional scopes required for authorization. |
core::oauth2::client |
|
staticprotected |
Guess an image from the discovery URL.
core::oauth2::issuer | $issuer | The desired OAuth issuer |
|
static |
Initializes a record for one of the standard issuers to be displayed in the settings.
The issuer is not yet created in the database.
string | $type | One of google, facebook, microsoft, nextcloud |
core::oauth2::issuer |
|
static |
Reorder this identity issuer.
Requires moodle/site:config capability at the system context.
int | $id | The id of the identity issuer to move. |
boolean |
|
static |
Reorder this identity issuer.
Requires moodle/site:config capability at the system context.
int | $id | The id of the identity issuer to move. |
boolean |
|
static |
Take the data from the mform and update the endpoint.
stdClass | $data |
core::oauth2::endpoint |
|
static |
Take the data from the mform and update the issuer.
stdClass | $data |
core::oauth2::issuer |
|
static |
Take the data from the mform and update the user field mapping.
stdClass | $data |
core::oauth2::user_field_mapping |