From 86d14bf0685166366a61516d36269c5c122025f5 Mon Sep 17 00:00:00 2001 From: Jordi Pujol-Ahullo Date: Fri, 25 Jul 2014 22:46:24 +0200 Subject: [PATCH] moodle-auth_ip - simplified code for portability through Moodle versions. Extended availability from Moodle 2.4 to Moodle 2.7. --- auth.php | 59 +++++++---------------------------------------------- version.php | 6 +++--- 2 files changed, 10 insertions(+), 55 deletions(-) diff --git a/auth.php b/auth.php index 42a4510..15bd1e5 100755 --- a/auth.php +++ b/auth.php @@ -31,12 +31,12 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once($CFG->libdir.'/authlib.php'); +require_once($CFG->dirroot.'/auth/manual/auth.php'); /** * Auth plugin to allow login only from restricted IPs. */ -class auth_plugin_ip extends auth_plugin_base { +class auth_plugin_ip extends auth_plugin_manual { /** * Constructor @@ -70,25 +70,6 @@ class auth_plugin_ip extends auth_plugin_base { return false; } - /** - * Updates the user's password. - * - * called when the user password is updated. - * - * @param object $user User table object (with system magic quotes) - * @param string $newpassword Plaintext password (with system magic quotes) - * @return boolean result - * - */ - function user_update_password($user, $newpassword) { - $user = get_complete_user_data('id', $user->id); - return update_internal_user_password($user, $newpassword); - } - - function prevent_local_passwords() { - return false; - } - /** * Returns true if this authentication plugin is 'internal'. * @@ -98,45 +79,19 @@ class auth_plugin_ip extends auth_plugin_base { return false; } - /** - * Returns true if this authentication plugin can change the user's - * password. - * - * @return bool - */ - function can_change_password() { - return true; - } - - /** - * Returns the URL for changing the user's pw, or empty if the default can - * be used. - * - * @return string - */ - function change_password_url() { - return ''; - } - - /** - * Returns true if plugin allows resetting of internal password. - * - * @return bool - */ - function can_reset_password() { - return true; - } - /** * 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 array $page An object containing all the data for this page. + * @param array $config An object containing all the data for this page. + * @param string $error + * @param array $user_fields + * @return void */ function config_form($config, $err, $user_fields) { - include "config.html"; + include 'config.html'; } /** diff --git a/version.php b/version.php index 441084b..9213330 100644 --- a/version.php +++ b/version.php @@ -27,9 +27,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2013072411; // The current plugin version (Date: YYYYMMDDXX) -$plugin->requires = 2013051400; // Requires this Moodle version (2.5) +$plugin->version = 2014072522; // The current plugin version (Date: YYYYMMDDXX) +$plugin->requires = 2012120300; // Requires this Moodle version (2.4) $plugin->component = 'auth_ip'; // Full name of the plugin (used for diagnostics) $plugin->maturity = MATURITY_STABLE; -$plugin->release = '1.0 Build: 2013101700'; +$plugin->release = '1.1 (Build: 2014072522)';