[ Index ] |
PHP Cross Reference of Unnamed Project |
[Source view] [Print] [Project Stats]
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: | 937 lines (35 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 1 file auth/db/config.html |
auth_plugin_db:: (25 methods):
__construct()
user_login()
db_init()
db_attributes()
get_userinfo()
user_update_password()
sync_users()
user_exists()
get_userlist()
get_userinfo_asobj()
update_user_record()
user_update()
validate_form()
prevent_local_passwords()
is_internal()
is_configured()
is_synchronised_with_external()
can_change_password()
change_password_url()
can_reset_password()
config_form()
process_config()
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. param: string $username The username param: string $password The password return: bool Authentication success or failure. |
db_init() X-Ref |
Connect to external database. return: ADOConnection |
db_attributes() X-Ref |
Returns user attribute mappings between moodle and ldap. return: array |
get_userinfo($username) X-Ref |
Reads any other information for a user from external database, then returns it in an array. param: string $username return: array |
user_update_password($user, $newpassword) X-Ref |
Change a user's password. param: stdClass $user User table object param: string $newpassword Plaintext password return: bool True on success |
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. param: progress_trace $trace param: bool $do_updates Optional: set to true to force an update of existing accounts return: int 0 means success, 1 means failure |
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. param: string $username username return: array |
update_user_record($username, $updatekeys=false) X-Ref |
will update a local user record from an external source. is a lighter version of the one in moodlelib -- won't do expensive ops such as enrolment. If you don't pass $updatekeys, there is a performance hit and values removed from DB won't be removed from moodle. param: string $username username param: bool $updatekeys return: stdClass |
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. param: stdClass $olduser Userobject before modifications param: stdClass $newuser Userobject new modified userobject return: boolean result |
validate_form($form, &$err) X-Ref |
A chance to validate form data, and last chance to do stuff before it is inserted in config_plugin param: stfdClass $form param: array $err errors return: void |
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 |
config_form($config, $err, $user_fields) X-Ref |
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. param: stdClass $config param: array $err errors param: array $user_fields return: void |
process_config($config) X-Ref |
Processes and stores configuration data for this authentication plugin. param: srdClass $config return: bool always true or exception |
ext_addslashes($text) X-Ref |
Add slashes, we can not use placeholders or system functions. param: string $text return: string |
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. param: array $user the user data to be validated against properties definition. return: stdClass $user the cleaned user data. |
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |