Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
auth_plugin_mnet Class Reference

Moodle Network authentication plugin. More...

Inheritance diagram for auth_plugin_mnet:
auth_plugin_base

Public Member Functions

 __construct ()
 Constructor.
 
 auth_plugin_mnet ()
 Old syntax of class constructor.
 
 can_be_manually_set ()
 Returns whether or not this authentication plugin can be manually set for users, for example, when bulk uploading users.
 
 can_change_password ()
 Returns true if this authentication plugin can change the user's password.
 
 can_confirm ()
 Returns true if plugin allows confirming of new users.
 
 can_edit_profile ()
 Returns true if this authentication plugin can edit the users' profile.
 
 can_login_remotely ($username, $mnethostid)
 Checks the MNET access control table to see if the username/mnethost is permitted to login to this moodle.
 
 can_reset_password ()
 Returns true if plugin allows resetting of internal password.
 
 can_signup ()
 Returns true if plugin allows resetting of internal password.
 
 change_password_url ()
 Returns the URL for changing the user's pw, or false if the default can be used.
 
 config_form ($config, $err, $user_fields)
 Prints a form for configuring this authentication plugin.
 
 confirm_mnet_session ($token, $remotepeer)
 This function confirms the remote (ID provider) host's mnet session by communicating the token and UA over the XMLRPC transport layer, and returns the local user record on success.
 
 edit_profile_url ()
 Returns the URL for editing the users' profile, or empty if the default URL can be used.
 
 end_local_sessions (&$sessionArray)
 To delete a host, we must delete all current sessions that users from that host are currently engaged in.
 
 fetch_theme_info ()
 Returns the theme information and logo url as strings.
 
 fetch_user_image ($username)
 Returns the user's profile image info.
 
 find_cli_user ()
 Identify a Moodle account on the CLI.
 
 generate_token ()
 Generate a random string for use as an RPC session token.
 
 get_custom_user_profile_fields ()
 Return custom user profile fields.
 
 get_description ()
 Get the auth description (from core or own auth lang files)
 
 get_extrauserinfo ()
 Returns extra user information.
 
 get_password_change_info (stdClass $user)
 Returns information on how the specified user can change their password.
 
 get_title ()
 Return the properly translated human-friendly title of this auth plugin.
 
 get_userinfo ($username)
 Read user information from external database and returns it as array().
 
 has_service ($mnethostid, $servicename)
 Determines if an MNET host is providing the nominated service.
 
 ignore_timeout_hook ($user, $sid, $timecreated, $timemodified)
 Hook called before timing out of database session.
 
 is_captcha_enabled ()
 Returns whether or not the captcha element is enabled.
 
 is_configured ()
 Returns false if this plugin is enabled but not configured.
 
 is_internal ()
 Returns true if this authentication plugin is 'internal'.
 
 is_synchronised_with_external ()
 Indicates if moodle should automatically update internal user records with data from external sources using the information from get_userinfo() method.
 
 keepalive_client ()
 Poll the IdP server to let it know that a user it has authenticated is still online.
 
 keepalive_server ($array)
 Receives an array of usernames from a remote machine and prods their sessions to keep them alive.
 
 kill_child ($username, $useragent)
 When the IdP requests that child sessions are terminated, this function will be called on each of the child hosts.
 
 kill_children ($username, $useragent)
 The IdP uses this function to kill child sessions on other hosts.
 
 kill_parent ($username, $useragent)
 The SP uses this function to kill the session on the parent IdP.
 
object loginpage_hook ()
 Hook for overriding behaviour of login page.
 
 loginpage_idp_list ($wantsurl)
 Returns a list of MNet IdPs that the user can roam from.
 
 logoutpage_hook ()
 Hook for overriding behaviour of logout page.
 
 password_expire ($username)
 return number of days to user password expires
 
 postlogout_hook ($user)
 Post logout hook.
 
 pre_loginpage_hook ()
 Hook for overriding behaviour before going to the login page.
 
 pre_user_login_hook (&$user)
 Pre user_login hook.
 
 prelogout_hook ()
 Cleanup any remote mnet_sessions, kill the local mnet_session data.
 
 prevent_local_passwords ()
 Indicates if password hashes should be stored in local moodle database.
 
 process_config ($config)
 Processes and stores configuration data for this authentication plugin.
 
 refresh_log ($array)
 Receives an array of log entries from an SP and adds them to the mnet_log table.
 
 set_extrauserinfo (array $values)
 Set extra user information.
 
 signup_form ()
 Return a form to capture user details for account creation.
 
 start_jump_session ($mnethostid, $wantsurl, $wantsurlbackhere=false)
 Starts an RPC jump session and returns the jump redirect URL.
 
 sync_roles ($user)
 Sync roles for this user - usually creator.
 
 test_settings ()
 Test if settings are correct, print info to output.
 
 trim_logline ($logline)
 Trims a log line from mnet peer to limit each part to a length which can be stored in our DB.
 
 update_enrolments ($username, $courses)
 Invoke this function on the IDP to update it with enrolment info local to the SP right after calling user_authorise()
 
 update_mnet_session ($user, $token, $remotepeer)
 creates (or updates) the mnet session once {
 
 user_authenticated_hook (&$user, $username, $password)
 Post authentication hook.
 
 user_authorise ($token, $useragent)
 Return user data for the provided token, compare with user_agent string.
 
 user_confirm ($username, $confirmsecret)
 Confirm the new user as registered.
 
 user_delete ($olduser)
 User delete requested - internal user record is mared as deleted already, username not present anymore.
 
 user_exists ($username)
 Checks if user exists in external db.
 
 user_login ($username, $password)
 This function is normally used to determine if the username and password are correct for local logins.
 
 user_signup ($user, $notify=true)
 Sign up a new user ready for confirmation.
 
 user_update ($olduser, $newuser)
 Called when the user record is updated.
 
 user_update_password ($user, $newpassword)
 Updates the user's password.
 
 validate_form ($form, &$err)
 A chance to validate form data, and last chance to do stuff before it is inserted in config_plugin.
 

Static Public Member Functions

static find_cli_admin_user ()
 Find an OS level admin Moodle user account.
 
static get_enabled_auth_plugin_classes ()
 Returns the enabled auth plugins.
 
static get_identity_providers ($authsequence)
 Return the list of enabled identity providers.
 
static login_cli_admin_user ()
 Find and login as an OS level admin Moodle user account.
 
static prepare_identity_providers_for_output ($identityproviders, renderer_base $output)
 Prepare a list of identity providers for output.
 

Public Attributes

string $authtype
 Authentication plugin type - the same as db field.
 
object $config
 The configuration details for the plugin.
 
array $userfields = core_user::AUTHSYNCFIELDS
 

Protected Member Functions

 update_user_record ($username, $updatekeys=false, $triggerevent=false, $suspenduser=false)
 Update a local user record from an external source.
 

Protected Attributes

string $errorlogtag = ''
 The tag we want to prepend to any error log messages.
 
array $extrauserinfo = []
 Stores extra information available to the logged in event.
 
mnet_environment $mnet
 mnet environment.
 

Detailed Description

Moodle Network authentication plugin.

Member Function Documentation

◆ auth_plugin_mnet()

auth_plugin_mnet::auth_plugin_mnet ( )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ can_be_manually_set()

auth_plugin_base::can_be_manually_set ( )
inherited

Returns whether or not this authentication plugin can be manually set for users, for example, when bulk uploading users.

This should be overriden by authentication plugins where setting the authentication method manually is allowed.

Return values
bool
Since
Moodle 2.6

Reimplemented in auth_oauth2\auth, auth_plugin_email, auth_plugin_ldap, auth_plugin_manual, auth_plugin_nologin, and auth_plugin_none.

◆ can_change_password()

auth_plugin_mnet::can_change_password ( )

Returns true if this authentication plugin can change the user's password.

Return values
bool

Reimplemented from auth_plugin_base.

◆ can_confirm()

auth_plugin_base::can_confirm ( )
inherited

Returns true if plugin allows confirming of new users.

Return values
bool

Reimplemented in auth_plugin_email, and auth_plugin_ldap.

◆ can_edit_profile()

auth_plugin_base::can_edit_profile ( )
inherited

Returns true if this authentication plugin can edit the users' profile.

Return values
bool

◆ can_login_remotely()

auth_plugin_mnet::can_login_remotely ( $username,
$mnethostid )

Checks the MNET access control table to see if the username/mnethost is permitted to login to this moodle.

Parameters
string$usernameThe username
int$mnethostidThe id of the remote mnethost
Return values
boolWhether the user can login from the remote host

◆ can_reset_password()

auth_plugin_base::can_reset_password ( )
inherited

Returns true if plugin allows resetting of internal password.

Return values
bool

Reimplemented in auth_oauth2\auth, auth_plugin_db, auth_plugin_email, auth_plugin_ldap, auth_plugin_manual, auth_plugin_nologin, auth_plugin_none, and auth_plugin_webservice.

◆ can_signup()

auth_plugin_base::can_signup ( )
inherited

Returns true if plugin allows resetting of internal password.

Return values
bool

Reimplemented in auth_plugin_email, and auth_plugin_ldap.

◆ change_password_url()

auth_plugin_mnet::change_password_url ( )

Returns the URL for changing the user's pw, or false if the default can be used.

Return values
moodle_url

Reimplemented from auth_plugin_base.

◆ config_form()

auth_plugin_base::config_form ( $config,
$err,
$user_fields )
inherited

Prints a form for configuring this authentication plugin.

This function is called from admin/auth.php, and outputs a full page with a form for configuring this plugin.

Parameters
object$config
object$err
array$user_fields
Deprecated
since Moodle 3.3

◆ confirm_mnet_session()

auth_plugin_mnet::confirm_mnet_session ( $token,
$remotepeer )

This function confirms the remote (ID provider) host's mnet session by communicating the token and UA over the XMLRPC transport layer, and returns the local user record on success.

Parameters
string$tokenThe random session token.
mnet_peer$remotepeerThe ID provider mnet_peer object.
Return values
arrayThe local user record.

◆ edit_profile_url()

auth_plugin_base::edit_profile_url ( )
inherited

Returns the URL for editing the users' profile, or empty if the default URL can be used.

This method is used if can_edit_profile() returns true. This method is called only when user is logged in, it may use global $USER.

Return values
?moodle_urlurl of the profile page or null if standard used

◆ end_local_sessions()

auth_plugin_mnet::end_local_sessions ( & $sessionArray)

To delete a host, we must delete all current sessions that users from that host are currently engaged in.

Parameters
string$sessionidarrayAn array of session hashes
Return values
boolTrue on success

◆ fetch_theme_info()

auth_plugin_mnet::fetch_theme_info ( )

Returns the theme information and logo url as strings.

Return values
stringThe theme info

◆ fetch_user_image()

auth_plugin_mnet::fetch_user_image ( $username)

Returns the user's profile image info.

If the user exists and has a profile picture, the returned array will contain keys: f1 - the content of the default 100x100px image f1_mimetype - the mimetype of the f1 file f2 - the content of the 35x35px variant of the image f2_mimetype - the mimetype of the f2 file

The mimetype information was added in Moodle 2.0. In Moodle 1.x, images are always jpegs.

See also
process_new_icon() @uses mnet_remote_client callable via MNet XML-RPC
Parameters
int$usernameThe id of the user
Return values
false|arrayfalse if user not found, empty array if no picture exists, array with data otherwise

◆ find_cli_admin_user()

static auth_plugin_base::find_cli_admin_user ( )
staticinherited

Find an OS level admin Moodle user account.

Used when running CLI scripts. Only accounts which are site admin will be accepted.

Return values
null|stdClassAdmin user record if found

◆ find_cli_user()

auth_plugin_base::find_cli_user ( )
inherited

Identify a Moodle account on the CLI.

For example a plugin might use posix_geteuid and posix_getpwuid to find the username of the OS level user and then match that against Moodle user accounts.

Return values
null|stdClassUser user record if found

◆ get_custom_user_profile_fields()

auth_plugin_base::get_custom_user_profile_fields ( )
inherited

Return custom user profile fields.

Return values
arraylist of custom fields.

◆ get_description()

auth_plugin_base::get_description ( )
inherited

Get the auth description (from core or own auth lang files)

Return values
stringThe description

◆ get_enabled_auth_plugin_classes()

static auth_plugin_base::get_enabled_auth_plugin_classes ( )
staticinherited

Returns the enabled auth plugins.

Return values
arrayof plugin classes

◆ get_extrauserinfo()

auth_plugin_base::get_extrauserinfo ( )
inherited

Returns extra user information.

Return values
arrayAn array of keys and values

◆ get_identity_providers()

static auth_plugin_base::get_identity_providers ( $authsequence)
staticinherited

Return the list of enabled identity providers.

Each identity provider data contains the keys url, name and iconurl (or icon). See the documentation of auth_plugin_base::loginpage_idp_list() for detailed description of the returned structure.

Parameters
array$authsequencesite's auth sequence (list of auth plugins ordered)
Return values
arrayList of arrays describing the identity providers

◆ get_password_change_info()

auth_plugin_base::get_password_change_info ( stdClass $user)
inherited

Returns information on how the specified user can change their password.

Parameters
stdClass$userA user object
Return values
string[]An array of strings with keys subject and message

Reimplemented in auth_oauth2\auth, and auth_plugin_nologin.

◆ get_title()

auth_plugin_base::get_title ( )
inherited

Return the properly translated human-friendly title of this auth plugin.

Todo
Document this function

◆ get_userinfo()

auth_plugin_base::get_userinfo ( $username)
inherited

Read user information from external database and returns it as array().

Function should return all information available. If you are saving this information to moodle user-table you should honour synchronisation flags

Parameters
string$usernameusername
Return values
mixedarray with no magic quotes or false on error

Reimplemented in auth_oauth2\auth, auth_plugin_cas, auth_plugin_db, auth_plugin_ldap, and auth_plugin_shibboleth.

◆ has_service()

auth_plugin_mnet::has_service ( $mnethostid,
$servicename )

Determines if an MNET host is providing the nominated service.

Parameters
int$mnethostidThe id of the remote host
string$servicenameThe name of the service
Return values
boolWhether the service is available on the remote host

◆ ignore_timeout_hook()

auth_plugin_base::ignore_timeout_hook ( $user,
$sid,
$timecreated,
$timemodified )
inherited

Hook called before timing out of database session.

This is useful for SSO and MNET.

Parameters
object$user
string$sidsession id
int$timecreatedstart of session
int$timemodifieduser last seen
Return values
booltrue means do not timeout session yet

◆ is_captcha_enabled()

auth_plugin_base::is_captcha_enabled ( )
inherited

Returns whether or not the captcha element is enabled.

@abstract Implement in child classes

Return values
bool

Reimplemented in auth_plugin_email.

◆ is_configured()

auth_plugin_base::is_configured ( )
inherited

Returns false if this plugin is enabled but not configured.

Return values
bool

Reimplemented in auth_plugin_db.

◆ is_internal()

auth_plugin_mnet::is_internal ( )

Returns true if this authentication plugin is 'internal'.

Return values
bool

Reimplemented from auth_plugin_base.

◆ is_synchronised_with_external()

auth_plugin_base::is_synchronised_with_external ( )
inherited

Indicates if moodle should automatically update internal user records with data from external sources using the information from get_userinfo() method.

Return values
booltrue means automatically copy data from ext to user table

Reimplemented in auth_oauth2\auth, and auth_plugin_db.

◆ keepalive_client()

auth_plugin_mnet::keepalive_client ( )

Poll the IdP server to let it know that a user it has authenticated is still online.

Return values
void

◆ keepalive_server()

auth_plugin_mnet::keepalive_server ( $array)

Receives an array of usernames from a remote machine and prods their sessions to keep them alive.

Parameters
array$arrayAn array of usernames
Return values
string"All ok" or an error message

◆ kill_child()

auth_plugin_mnet::kill_child ( $username,
$useragent )

When the IdP requests that child sessions are terminated, this function will be called on each of the child hosts.

The machine that calls the function (over xmlrpc) provides us with the mnethostid we need.

Parameters
string$usernameUsername for session to kill
string$useragentSHA1 hash of user agent to look for
Return values
boolTrue on success

◆ kill_children()

auth_plugin_mnet::kill_children ( $username,
$useragent )

The IdP uses this function to kill child sessions on other hosts.

Parameters
string$usernameUsername for session to kill
string$useragentSHA1 hash of user agent to look for
Return values
stringA plaintext report of what has happened

◆ kill_parent()

auth_plugin_mnet::kill_parent ( $username,
$useragent )

The SP uses this function to kill the session on the parent IdP.

Parameters
string$usernameUsername for session to kill
string$useragentSHA1 hash of user agent to look for
Return values
stringA plaintext report of what has happened

◆ login_cli_admin_user()

static auth_plugin_base::login_cli_admin_user ( )
staticinherited

Find and login as an OS level admin Moodle user account.

Used for running CLI scripts which must be admin accounts.

◆ loginpage_hook()

object auth_plugin_base::loginpage_hook ( )
inherited

Hook for overriding behaviour of login page.

This method is called from login/index.php page for all enabled auth plugins.

@global object

Reimplemented in auth_plugin_cas, auth_plugin_ldap, and auth_plugin_shibboleth.

◆ loginpage_idp_list()

auth_plugin_mnet::loginpage_idp_list ( $wantsurl)

Returns a list of MNet IdPs that the user can roam from.

Parameters
string$wantsurlThe relative url fragment the user wants to get to.
Return values
arrayList of arrays with keys url, icon and name.

Reimplemented from auth_plugin_base.

◆ logoutpage_hook()

auth_plugin_mnet::logoutpage_hook ( )

Hook for overriding behaviour of logout page.

This method is called from login/logout.php page for all enabled auth plugins.

@global string

Reimplemented from auth_plugin_base.

◆ password_expire()

auth_plugin_base::password_expire ( $username)
inherited

return number of days to user password expires

If userpassword does not expire it should return 0. If password is already expired it should return negative value.

Parameters
mixed$usernameusername (with system magic quotes)
Return values
integer

Reimplemented in auth_plugin_ldap, and auth_plugin_manual.

◆ postlogout_hook()

auth_plugin_base::postlogout_hook ( $user)
inherited

Post logout hook.

This method is used after moodle logout by auth classes to execute server logout.

Parameters
stdClass$userclone of USER object before the user session was terminated

Reimplemented in auth_plugin_cas.

◆ pre_loginpage_hook()

auth_plugin_base::pre_loginpage_hook ( )
inherited

Hook for overriding behaviour before going to the login page.

This method is called from require_login from potentially any page for all enabled auth plugins and gives each plugin a chance to redirect directly to an external login page, or to instantly login a user where possible.

If an auth plugin implements this hook, it must not rely on ONLY this hook in order to work, as there are many ways a user can browse directly to the standard login page. As a general rule in this case you should also implement the loginpage_hook as well.

◆ pre_user_login_hook()

auth_plugin_base::pre_user_login_hook ( & $user)
inherited

Pre user_login hook.

This method is called from authenticate_user_login() right after the user object is generated. This gives the auth plugins an option to make adjustments before the verification process starts.

Parameters
object$useruser object, later used for $USER

◆ prelogout_hook()

auth_plugin_mnet::prelogout_hook ( )

Cleanup any remote mnet_sessions, kill the local mnet_session data.

This is called by require_logout in moodlelib

Return values
void

Reimplemented from auth_plugin_base.

◆ prepare_identity_providers_for_output()

static auth_plugin_base::prepare_identity_providers_for_output ( $identityproviders,
renderer_base $output )
staticinherited

Prepare a list of identity providers for output.

Parameters
array$identityprovidersas returned by self::get_identity_providers()
renderer_base$output
Return values
arraythe identity providers ready for output

◆ prevent_local_passwords()

auth_plugin_mnet::prevent_local_passwords ( )

Indicates if password hashes should be stored in local moodle database.

Return values
booltrue means md5 password hash stored in user table, false means flag 'not_cached' stored there instead

Reimplemented from auth_plugin_base.

◆ process_config()

auth_plugin_base::process_config ( $config)
inherited

Processes and stores configuration data for this authentication plugin.

Parameters
objectobject with submitted configuration settings (without system magic quotes)
Deprecated
since Moodle 3.3

◆ refresh_log()

auth_plugin_mnet::refresh_log ( $array)

Receives an array of log entries from an SP and adds them to the mnet_log table.

Deprecated
since Moodle 2.8 Please don't use this function for recording mnet logs.
Parameters
array$arrayAn array of usernames
Return values
string"All ok" or an error message

◆ set_extrauserinfo()

auth_plugin_base::set_extrauserinfo ( array $values)
inherited

Set extra user information.

Parameters
array$valuesAny Key value pair.
Return values
void

◆ signup_form()

auth_plugin_base::signup_form ( )
inherited

Return a form to capture user details for account creation.

This is used in /login/signup.php.

Return values
moodleformA form which edits a record from the user table.

◆ start_jump_session()

auth_plugin_mnet::start_jump_session ( $mnethostid,
$wantsurl,
$wantsurlbackhere = false )

Starts an RPC jump session and returns the jump redirect URL.

Parameters
int$mnethostidid of the mnet host to jump to
string$wantsurlurl to redirect to after the jump (usually on remote system)
boolean$wantsurlbackheredefaults to false, means that the remote system should bounce us back here rather than somewhere inside its wwwroot

◆ sync_roles()

auth_plugin_base::sync_roles ( $user)
inherited

Sync roles for this user - usually creator.

Parameters
$userobject user object (without system magic quotes)

Reimplemented in auth_plugin_ldap.

◆ trim_logline()

auth_plugin_mnet::trim_logline ( $logline)

Trims a log line from mnet peer to limit each part to a length which can be stored in our DB.

Parameters
object$loglineThe log information to be trimmed
Return values
objectThe passed logline object trimmed to not exceed storable limits

◆ update_enrolments()

auth_plugin_mnet::update_enrolments ( $username,
$courses )

Invoke this function on the IDP to update it with enrolment info local to the SP right after calling user_authorise()

Normally called by the SP after calling user_authorise()

Parameters
string$usernameThe username
array$coursesAssoc array of courses following the structure of mnetservice_enrol_courses
Return values
bool

◆ update_mnet_session()

auth_plugin_mnet::update_mnet_session ( $user,
$token,
$remotepeer )

creates (or updates) the mnet session once {

See also
confirm_mnet_session} and {
complete_user_login} have both been called
Parameters
stdclass$userthe local user (must exist already
string$tokenthe jump/land token
mnet_peer$remotepeerthe mnet_peer object of this users's idp

◆ update_user_record()

auth_plugin_base::update_user_record ( $username,
$updatekeys = false,
$triggerevent = false,
$suspenduser = false )
protectedinherited

Update a local user record from an external source.

This is a lighter version of the one in moodlelib – won't do expensive ops such as enrolment.

Parameters
string$usernameusername
array$updatekeysfields to update, false updates all fields.
bool$triggereventset false if user_updated event should not be triggered. This will not affect user_password_updated event triggering.
bool$suspenduserShould the user be suspended?
Return values
stdClass|boolupdated user record or false if there is no new info to update.

◆ user_authenticated_hook()

auth_plugin_base::user_authenticated_hook ( & $user,
$username,
$password )
inherited

Post authentication hook.

This method is called from authenticate_user_login() for all enabled auth plugins.

Parameters
object$useruser object, later used for $USER
string$username(with system magic quotes)
string$passwordplain text password (with system magic quotes)

◆ user_authorise()

auth_plugin_mnet::user_authorise ( $token,
$useragent )

Return user data for the provided token, compare with user_agent string.

Parameters
string$tokenThe unique ID provided by remotehost.
string$useragentUser Agent string.
Return values
array\$userdataArray of user info for remote host

◆ user_confirm()

auth_plugin_base::user_confirm ( $username,
$confirmsecret )
inherited

Confirm the new user as registered.

Parameters
string$username
string$confirmsecret

Reimplemented in auth_oauth2\auth, auth_plugin_email, auth_plugin_ldap, auth_plugin_manual, and auth_plugin_webservice.

◆ user_delete()

auth_plugin_base::user_delete ( $olduser)
inherited

User delete requested - internal user record is mared as deleted already, username not present anymore.

Do any action in external database.

Parameters
object$userUserobject before delete (without system magic quotes)
Return values
void

◆ user_exists()

auth_plugin_base::user_exists ( $username)
inherited

Checks if user exists in external db.

Parameters
string$username(with system magic quotes)
Return values
bool

Reimplemented in auth_plugin_db, and auth_plugin_ldap.

◆ user_login()

auth_plugin_mnet::user_login ( $username,
$password )

This function is normally used to determine if the username and password are correct for local logins.

Always returns false, as local users do not need to login over mnet xmlrpc.

Parameters
string$usernameThe username
string$passwordThe password
Return values
boolAuthentication success or failure.

Reimplemented from auth_plugin_base.

◆ user_signup()

auth_plugin_base::user_signup ( $user,
$notify = true )
inherited

Sign up a new user ready for confirmation.

Password is passed in plaintext.

Parameters
object$usernew user object
boolean$notifyprint notice with link and terminate

Reimplemented in auth_plugin_email, and auth_plugin_ldap.

◆ user_update()

auth_plugin_base::user_update ( $olduser,
$newuser )
inherited

Called when the user record is updated.

Modifies user in external database. It takes olduser (before changes) and newuser (after changes) compares information saved modified information to external db.

Parameters
mixed$olduserUserobject before modifications (without system magic quotes)
mixed$newuserUserobject new modified userobject (without system magic quotes)
Return values
booleantrue if updated or update ignored; false if error

Reimplemented in auth_plugin_db, and auth_plugin_ldap.

◆ user_update_password()

auth_plugin_base::user_update_password ( $user,
$newpassword )
inherited

Updates the user's password.

In previous versions of Moodle, the function auth_user_update_password accepted a username as the first parameter. The revised function expects a user object.

Parameters
object$userUser table object
string$newpasswordPlaintext password
Return values
boolTrue on success

Reimplemented in auth_plugin_db, auth_plugin_email, auth_plugin_ldap, auth_plugin_manual, auth_plugin_nologin, auth_plugin_none, and auth_plugin_webservice.

◆ validate_form()

auth_plugin_base::validate_form ( $form,
& $err )
inherited

A chance to validate form data, and last chance to do stuff before it is inserted in config_plugin.

Parameters
objectobject with submitted configuration settings (without system magic quotes)
array$errarray of error messages
Deprecated
since Moodle 3.3

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