Differences Between: [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
Authentication Plugin: External Database Authentication Checks against an external database.
Author: | Martin Dougiamas |
License: | http://www.gnu.org/copyleft/gpl.html GNU Public License |
File Size: | 790 lines (30 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
auth_plugin_db:: (21 methods):
__construct()
user_login()
db_init()
db_attributes()
get_userinfo()
user_update_password()
sync_users()
user_exists()
get_userlist()
get_userinfo_asobj()
user_update()
prevent_local_passwords()
is_internal()
is_configured()
is_synchronised_with_external()
can_change_password()
change_password_url()
can_reset_password()
ext_addslashes()
test_settings()
clean_data()
Class: auth_plugin_db - X-Ref
External database authentication plugin.__construct() X-Ref |
Constructor. |
user_login($username, $password) X-Ref |
Returns true if the username and password work and false if they are wrong or don't exist. return: bool Authentication success or failure. param: string $username The username param: string $password The password |
db_init() X-Ref |
Connect to external database. return: ADOConnection |
db_attributes() X-Ref |
Returns user attribute mappings between moodle and the external database. return: array |
get_userinfo($username) X-Ref |
Reads any other information for a user from external database, then returns it in an array. return: array param: string $username |
user_update_password($user, $newpassword) X-Ref |
Change a user's password. return: bool True on success param: stdClass $user User table object param: string $newpassword Plaintext password |
sync_users(progress_trace $trace, $do_updates=false) X-Ref |
Synchronizes user from external db to moodle user table. Sync should be done by using idnumber attribute, not username. You need to pass firstsync parameter to function to fill in idnumbers if they don't exists in moodle user table. Syncing users removes (disables) users that don't exists anymore in external db. Creates new users and updates coursecreator status of users. This implementation is simpler but less scalable than the one found in the LDAP module. return: int 0 means success, 1 means failure param: progress_trace $trace param: bool $do_updates Optional: set to true to force an update of existing accounts |
user_exists($username) X-Ref |
No description |
get_userlist() X-Ref |
No description |
get_userinfo_asobj($username) X-Ref |
Reads user information from DB and return it in an object. return: array param: string $username username |
user_update($olduser, $newuser) X-Ref |
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. return: boolean result param: stdClass $olduser Userobject before modifications param: stdClass $newuser Userobject new modified userobject |
prevent_local_passwords() X-Ref |
No description |
is_internal() X-Ref |
Returns true if this authentication plugin is "internal". Internal plugins use password hashes from Moodle user table for authentication. return: bool |
is_configured() X-Ref |
Returns false if this plugin is enabled but not configured. return: bool |
is_synchronised_with_external() X-Ref |
Indicates if moodle should automatically update internal user records with data from external sources using the information from auth_plugin_base::get_userinfo(). return: bool true means automatically copy data from ext to user table |
can_change_password() X-Ref |
Returns true if this authentication plugin can change the user's password. return: bool |
change_password_url() X-Ref |
Returns the URL for changing the user's pw, or empty if the default can be used. return: moodle_url |
can_reset_password() X-Ref |
Returns true if plugin allows resetting of internal password. return: bool |
ext_addslashes($text) X-Ref |
Add slashes, we can not use placeholders or system functions. return: string param: string $text |
test_settings() X-Ref |
Test if settings are ok, print info to output. |
clean_data($user) X-Ref |
Clean the user data that comes from an external database. return: stdClass $user the cleaned user data. param: array $user the user data to be validated against properties definition. |