Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | List of all members
auth_oauth2\api Class Reference

Static list of api methods for auth oauth2 configuration. More...

Static Public Member Functions

static clean_orphaned_linked_logins ($issuerid=false)
 Remove all linked logins that are using issuers that have been deleted. More...
 
static confirm_link_login ($userid, $username, $issuerid, $token)
 Look for a waiting confirmation token, and if we find a match - confirm it. More...
 
static create_new_confirmed_account ($userinfo, $issuer)
 Create an account with a linked login that is already confirmed. More...
 
static delete_linked_login ($linkedloginid)
 Delete linked login. More...
 
static get_linked_logins ($userid=false)
 List linked logins. More...
 
static is_enabled ()
 Is the plugin enabled. More...
 
static link_login ($userinfo, $issuer, $userid=false, $skippermissions=false)
 Link a login to this account. More...
 
static match_username_to_user ($username, $issuer)
 See if there is a match for this username and issuer in the linked_login table. More...
 
static send_confirm_account_email ($userinfo, $issuer)
 Send an email with a link to confirm creating this account. More...
 
static send_confirm_link_login_email ($userinfo, $issuer, $userid)
 Send an email with a link to confirm linking this account. More...
 
static user_deleted (\core\event\user_deleted $event)
 Delete linked logins for a user. More...
 

Detailed Description

Static list of api methods for auth oauth2 configuration.

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

Member Function Documentation

◆ clean_orphaned_linked_logins()

static auth_oauth2\api::clean_orphaned_linked_logins (   $issuerid = false)
static

Remove all linked logins that are using issuers that have been deleted.

Parameters
int$issueridThe issuer id of the issuer to check, or false to check all (defaults to all)
Return values
boolean

◆ confirm_link_login()

static auth_oauth2\api::confirm_link_login (   $userid,
  $username,
  $issuerid,
  $token 
)
static

Look for a waiting confirmation token, and if we find a match - confirm it.

Parameters
int$userid
string$username
int$issuerid
string$token
Return values
booleanTrue if we linked.

◆ create_new_confirmed_account()

static auth_oauth2\api::create_new_confirmed_account (   $userinfo,
  $issuer 
)
static

Create an account with a linked login that is already confirmed.

Parameters
array$userinfoas returned from an oauth client.
core::oauth2::issuer$issuer
Return values
bool

◆ delete_linked_login()

static auth_oauth2\api::delete_linked_login (   $linkedloginid)
static

Delete linked login.

Requires auth/oauth2:managelinkedlogins capability at the user context.

Parameters
int$linkedloginid
Return values
boolean

◆ get_linked_logins()

static auth_oauth2\api::get_linked_logins (   $userid = false)
static

List linked logins.

Requires auth/oauth2:managelinkedlogins capability at the user context.

Parameters
int$userid(defaults to $USER->id)
Return values
boolean

◆ is_enabled()

static auth_oauth2\api::is_enabled ( )
static

Is the plugin enabled.

Return values
bool

◆ link_login()

static auth_oauth2\api::link_login (   $userinfo,
  $issuer,
  $userid = false,
  $skippermissions = false 
)
static

Link a login to this account.

Requires auth/oauth2:managelinkedlogins capability at the user context.

Parameters
array$userinfoas returned from an oauth client.
core::oauth2::issuer$issuer
int$userid(defaults to $USER->id)
bool$skippermissionsDuring signup we need to set this before the user is setup for capability checks.
Return values
bool

◆ match_username_to_user()

static auth_oauth2\api::match_username_to_user (   $username,
  $issuer 
)
static

See if there is a match for this username and issuer in the linked_login table.

Parameters
string$usernameas returned from an oauth client.
core::oauth2::issuer$issuer
Return values
stdClassUser record if found.

◆ send_confirm_account_email()

static auth_oauth2\api::send_confirm_account_email (   $userinfo,
  $issuer 
)
static

Send an email with a link to confirm creating this account.

Parameters
array$userinfoas returned from an oauth client.
core::oauth2::issuer$issuer
int$userid(defaults to $USER->id)
Return values
bool

◆ send_confirm_link_login_email()

static auth_oauth2\api::send_confirm_link_login_email (   $userinfo,
  $issuer,
  $userid 
)
static

Send an email with a link to confirm linking this account.

Parameters
array$userinfoas returned from an oauth client.
core::oauth2::issuer$issuer
int$userid(defaults to $USER->id)
Return values
bool

◆ user_deleted()

static auth_oauth2\api::user_deleted ( \core\event\user_deleted  $event)
static

Delete linked logins for a user.

Parameters
core::event::user_deleted$event
Return values
boolean

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