Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
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. | |
static | create_endpoint ($data) |
Take the data from the mform and create the endpoint. | |
static | create_endpoints_for_standard_issuer ($type, $issuer) |
Create endpoints for standard issuers, based on the issuer created from submitted data. | |
static | create_issuer ($data) |
Take the data from the mform and create the issuer. | |
static | create_standard_issuer ($type, $baseurl=false) |
Create one of the standard issuers. | |
static | create_user_field_mapping ($data) |
Take the data from the mform and create the user field mapping. | |
static | delete_endpoint ($id) |
Delete an endpoint. | |
static | delete_issuer ($id) |
Delete an identity issuer. | |
static | delete_user_field_mapping ($id) |
Delete a user_field_mapping. | |
static | disable_issuer ($id) |
Disable an identity issuer. | |
static | enable_issuer ($id) |
Enable an identity issuer. | |
static | get_all_issuers (bool $includeloginonly=false) |
List all the issuers, ordered by the sortorder field. | |
static | get_endpoint ($id) |
Get a single endpoint by id. | |
static | get_endpoints (issuer $issuer) |
Get the list of defined endpoints for this OAuth issuer. | |
static | get_issuer ($id) |
Get a single issuer by id. | |
static | get_system_account (issuer $issuer) |
Get the system account for an installed OAuth service. | |
static | get_system_oauth_client (issuer $issuer) |
Get an authenticated oauth2 client using the system account. | |
static | get_system_scopes_for_issuer ($issuer) |
Get the full list of system scopes required by an oauth issuer. | |
static | get_user_field_mapping ($id) |
Get a single user field mapping by id. | |
static | get_user_field_mappings (issuer $issuer) |
Get the list of defined mapping from OAuth user fields to moodle user fields. | |
static | get_user_oauth_client (issuer $issuer, moodle_url $currenturl, $additionalscopes='', $autorefresh=false) |
Get an authenticated oauth2 client using the current user account. | |
static | init_standard_issuer ($type) |
Initializes a record for one of the standard issuers to be displayed in the settings. | |
static | move_down_issuer ($id) |
Reorder this identity issuer. | |
static | move_up_issuer ($id) |
Reorder this identity issuer. | |
static | update_endpoint ($data) |
Take the data from the mform and update the endpoint. | |
static | update_issuer ($data) |
Take the data from the mform and update the issuer. | |
static | update_user_field_mapping ($data) |
Take the data from the mform and update the user field mapping. | |
Static Protected Member Functions | |
static | create_or_update_issuer ($data, bool $create) |
Take the data from the mform and create or update the issuer. | |
static | get_client_classname (?string $type) |
Get the client classname for an issuer. | |
static | get_service_classname (?string $type) |
Get the service classname for an issuer. | |
static | guess_image ($issuer) |
Guess an image from the discovery URL. | |
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, imsobv2p1 |
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 |
|
staticprotected |
Take the data from the mform and create or update the issuer.
stdClass | $data | Form data for them issuer to be created/updated. |
bool | $create | If true, the issuer will be created; otherwise, it will be updated. |
issuer | The created/updated issuer. |
|
static |
Create one of the standard issuers.
string | $type | One of google, facebook, microsoft, MoodleNet, nextcloud or imsobv2p1 |
string | false | $baseurl | Baseurl (only required for nextcloud, imsobv2p1 and moodlenet) |
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 |
|
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.
bool | $includeloginonly | also include issuers that are configured to be shown only on login page, By default false, in this case the method returns all issuers that can be used in services |
core\oauth2\issuer[] |
|
staticprotected |
Get the client classname for an issuer.
string | $type | The OAuth issuer type (google, facebook...). |
string | The classname for the custom client or core client class if the class for the defined type doesn't exist or null type is defined. |
|
static |
|
static |
Get the list of defined endpoints for this OAuth issuer.
core\oauth2\issuer | $issuer | The desired OAuth issuer |
core\oauth2\endpoint[] |
|
static |
|
staticprotected |
Get the service classname for an issuer.
string | $type | The OAuth issuer type (google, facebook...). |
string | The classname for this issuer or "Custom" service class if the class for the defined type doesn't exist or null type is defined. |
|
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. |
bool | $autorefresh | Should the client support the use of refresh tokens to persist access across sessions. |
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, imsobv2p1 |
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 |